[103:7] extends: object
This class is provided to allow personalization to each sender of an email. The class name is long but it matches the one used by SendGrid API.
to
List of to email address.
from
Optional from email address.
cc
Optional list of carbon copy email address.
bcc
Optional list of blind carbon copy email address.
headers
Optional map of email headers.
subject
The email subject.
sendAt
This is an int with the milliseconds since epoch with the date at which to send the email.
personalization (list ToEmailAddresses)
Craetes a new personalization object with the provided list of to email addresses.
ToEmailAddresses is a list of strings with the to email addresses.this objectsetTo (list ToEmailAddresses)
Sets the list of to email addersses.
ToEmailAddresses is a list of strings with the to email addresses.this object[172:7] extends: object
This class is used to provide an attachment to the sendgrid object to send in an email.
fileName
This is the string with the file name of the attachment.
content
The content field will contain a string with the data. It will be either a plain text string, or a Base64 encoded binary file.
type
The mime type of the attachment. ('text/plain', 'text/html', ...)
disposition
A string with the email disposition. (default null)
contentId
If disposition is set to 'inline' then this can be set and used to display images within an email body. (default null)
attachment (string FileName, Content)
Default constructor sets the provided file name and content. The content can either be a string or a Buffer object. One thing to note, if this is a binary file, make sure to read it with file.readBinary() instead of file.read() because file.readBinary() will return a Buffer object with the binary data and attachment will deal with that file properly.
FileName is a string with the file name to set.Content is either a string or a Buffer object with the content.this objectsetFile (string FileName, string Content)
Sets a plain text file attachment with the provided file name and content.
FileName is a string with the attachent file name.Content is a string with the file contents.this objectsetBinaryFile (string FileName, object Buff)
Sets a binary file attachment with the provided file name and content.
FileName is a string with the attachent file name.Buffer is a Buffer object with the file contents.this object[29:14] (extern: com.lehman.aussomserver.connectors.AussomSendGrid) extends: object
The sendgrid class provides email sending functionality provided by Twilio SendGrid. It supports sending a single simple email to advanced and customized options. If you can every get through the SendGrid/Twilio account creation process (good luck), here's how you get an API key. Under Settings -> API Keys -> Create API Key. Give it a meaningful name and create the Key. Copy it to a safe place, you will need it to provide in the constructor.
sendgrid (string ApiKey)
Create a new sendgrid object with the provided API key.
ApiKey is a string with the sendgrid API key to use.this objectnewSendGrid (string ApiKey)
from (string FromEmail)
Set the from email address.
FromEmail is a string with the from email address.this objectto (string ToEmail)
Sets the to email addess with the provided email address string. Note that this function will clear any existing
subject (string Subject)
Sets the provided subject string.
Subject is a string with the subject to set.this objectcontent (string Content, string ContentType = "text/plain")
Sets the provided content string and the optional content type string.
Content is a string with the content to set.ContentType is an optional string with the content type to set. (default: text/plain)this objectsend ()
Sends the email(s) and returns a map with the results. The result map will have statusCode, body, headers which is a map of string - string with the headers.
A map with the response.addPersonalization (object Personalization)
Adds the provided personalization object. See the personalization object for details.
Personalization is the personalization object to add.this objectaddAttachment (object Attachment)
Adds the provided attachment object. See the attachment object for details.
Attachment is the attachment object to add.this object