OScript API/Built-in Package Index |
The built-in functions in the MailMessage class provide the ability to create and read e-mail messages for SMTP or POP3 sessions.
The MailMessage class offers the following functionality:
Add a recipient as a blind-carbon-copy (BCC) recipient of an e-mail message.
Add a recipient as a carbon-copy (CC) recipient of an e-mail message.
Set the Content-Disposition for a message part to 'attachment'.
Set the Content-Disposition for a message part to 'inline'.
Set the message Content-Transfer-Encoding to '7-bit'.
Set the message Content-Transfer-Encoding to '8-bit'.
Set the message Content-Transfer-Encoding to 'base64'.
Set the message Content-Transfer-Encoding to 'quoted-printable'.
Add a recipient as the primary recipient of an e-mail message.
Returns a new, empty MailMessage object.
Adds inline content to a multipart e-mail message.
Same as calling AddFilePart( attachmentName, filename, CONTENT_ATTACHMENT, contentEncoding, contentType ).
Adds a part from a file to a multipart e-mail.
Adds an image part to a multipart message.
Add a recipient to an e-mail.
Same as calling AddStringPart( attachmentName, stringData, CONTENT_ATTACHMENT, contentEncoding, contentType ) .
Adds string data to a multipart e-mail.
Retrieves a list of the multipart content.
Retrieves the body of the message.
Retrieves the e-mail content type.
Retrieves the date of the e-mail.
Returns the set of all the e-mail message headers.
Retrieves the field data for a specific header field.
Returns a list of all the e-mail message headers.
Retrieve the a string for the last error code.
Retrieves a table of the multipart content.
Retrieves the full text of the raw message.
Returns a RecArray of recipients.
Retrieves the sender of the e-mail.
Returns the subject of the e-mail.
Checks if the message is a multipart e-mail.
Processes the MailMessage data and returns an Assoc.
Adds content to the body of the e-mail.
Set the e-mail content type.
Sets the origination date of the e-mail.
Sets a generic header field in the message.
Reads a String representation of an e-mail message.
Sets the sender of the e-mail.
Sets the subject of the e-mail.
Add a recipient as a blind-carbon-copy (BCC) recipient of an e-mail message.
Add a recipient as a carbon-copy (CC) recipient of an e-mail message.
Set the Content-Disposition for a message part to 'attachment'.
Set the Content-Disposition for a message part to 'inline'.
Set the message Content-Transfer-Encoding to '7-bit'.
Set the message Content-Transfer-Encoding to '8-bit'.
Set the message Content-Transfer-Encoding to 'base64'.
Set the message Content-Transfer-Encoding to 'quoted-printable'.
Add a recipient as the primary recipient of an e-mail message.
Returns a new, empty MailMessage object.
A new MailMessage object or Undefined if there was an error constructing the object.
Adds inline content to a multipart e-mail message.
the content to inline
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
Returns 0 for success and -1 if an error occurred.
Same as calling AddFilePart( attachmentName, filename, CONTENT_ATTACHMENT, contentEncoding, contentType ).
If the contentType is not specified, then it will be assumed to be "application/octet-stream".
the name of the attachment
the filename of the attachment
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
the content type of the attachment
Returns 0 for success and -1 if an error occurred.
Adds a part from a file to a multipart e-mail.
If the contentType is not specified, then it will be assumed to be "application/octet-stream".
the name for the part
the filename to use for the part data
the content disposition type: CONTENT_ATTACHMENT or CONTENT_INLINE
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
the content type of the message part
Returns 0 for success and -1 if an error occurred.
Adds an image part to a multipart message. The image is included via Content-ID in an HTML body part.
the name for the part
the filename to use for the image
the content ID that corresponds to an image embedded in the HTML content
the content disposition type: CONTENT_ATTACHMENT or CONTENT_INLINE
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
the content type of the image part
Returns 0 for success and -1 if an error occurred.
// Create a new mail message MailMessage m = MailMessage.New() // To: John W. Doe <john.doe@example.com> m.AddRecipient( MailMessage.PRIMARY_RECIPIENT, "john.doe@example.com", "John W. Doe" ) // Cc: Jane Doe <jane.doe@example.com> m.AddRecipient( MailMessage.CC_RECIPIENT, "jane.doe@example.com", "Jane Doe" ) // Add the HTML body which includes the image m.AddStringPart( 'body', 'Example body <img src="cid:example_image">', MAILMESSAGE.CONTENT_INLINE, MAILMESSAGE.ENCODING_BASE64, 'text/html' ) // Add the image from a file m.AddImagePart( 'image', '/path/to/image.png', 'example_image', MAILMESSAGE.CONTENT_INLINE, MAILMESSAGE.ENCODING_BASE64, 'image/png' )
The type can be one of PRIMARY_RECIPIENT, CC_RECIPIENT or BCC_RECIPIENT.
The e-mail parameter should be the fully qualified e-mail address and the fullName parameter is optional and can contain the user's full name (e.g. "John Doe").
recipient type: PRIMARY_RECIPIENT, CC_RECIPIENT, or BCC_RECIPIENT
fully qualified e-mail address of the recipient
the full name of the recipient
Returns 0 for success and -1 if an error occurred.
// Create a new mail message MailMessage m = MailMessage.New() // To: John W. Doe <john.doe@example.com> m.AddRecipient( MailMessage.PRIMARY_RECIPIENT, "john.doe@example.com", "John W. Doe" ) // Cc: Jane Doe <jane.doe@example.com> m.AddRecipient( MailMessage.CC_RECIPIENT, "jane.doe@example.com", "Jane Doe" )
Same as calling AddStringPart( attachmentName, stringData, CONTENT_ATTACHMENT, contentEncoding, contentType ).
If the contentType is not specified, then it will be assumed to be "text/plain; charset=UTF-8".
the name for the attachment
the string data of the attachment
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
the content type of the message part
Returns 0 for success and -1 if an error occurred.
Adds parts to a multipart e-mail, from a text source.
If the contentType is not specified, then it will be assumed to be "text/plain; charset=UTF-8".
the name for the part
the string data to use for the part data
the content disposition type: CONTENT_ATTACHMENT or CONTENT_INLINE
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
the content type of the message part
Returns 0 for success and -1 if an error occurred.
Returns a List of all the parts in a multipart message. Each part is an Assoc which contains the following keys:
Returns a RecArray of all of the parts in the e-mail.
Returns a string containing the content, or body, of the e-mail. This is only applicable for single-part messages.
Returns a string containing the content, or body, of the e-mail.
Retrieves the e-mail content type.
the content type of the e-mail.
Gets the date of the e-mail.
The origination date of the e-mail, adjusted to UTC.
Returns the set all the message headers as an Assoc. The Assoc will be Undefined if an error occurred.
Returns the set of all the message headers as an Assoc. The Assoc will be Undefined if an error occurred.
Gets the data of the specified header field. If the message doesn't contain the fieldname, then the string is empty.
the name of the field to retrieve
The data of the field, or an empty String if the header field does not exist.
Returns a List of all the message headers. The list will be Undefined if an error occurred.
a List of all the message headers. The list will be Undefined if an error occurred.
No parameters. Returns an error string for the last error that occurred.
Returns an error string for the last error that occurred.
Returns a RecArray of all top-level parts in a multipart message. The following fields will be returned for each part:
Returns a RecArray of all of the parts in the e-mail.
Returns a String containing the entire raw contents of the e-mail.
Returns a String containing the entire raw contents of the e-mail.
Returns a RecArray of the current e-mail recipients. Each recipient record consists of the following data:
Returns a RecArray of the current e-mail recipients.
Gets the sender of the e-mail.
Returns the sender of the e-mail.
Gets the subject of the e-mail.
Returns the subject of the e-mail.
TRUE if the e-mail is a multipart e-mail, FALSE otherwise. No parameters.
Returns TRUE if the e-mail is a multipart e-mail, FALSE otherwise.
Processes the MailMessage data and returns an Assoc. The Assoc has the following keys:
The processed MailMessage data
Adds text to the body of the e-mail. This function is only for single-part messages.
the content to add to the body
the content transfer encoding type: ENCODING_7BIT, ENCODING_8BIT, ENCODING_QUOTEDPRINTABLE, or ENCODING_BASE64
Returns 0 for success and -1 if an error occurred.
Sets the content type of the e-mail.
Sets the content type of the e-mail.
Returns 0 for success and -1 if an error occurred.
Sets the origination date of the e-mail.
the origination date of the e-mail
Returns 0 for success and -1 if an error occurred.
Sets a generic header field in the message.
the name of the field to set
the String representation of the value for the field
Returns 0 for success and -1 if an error occurred.
Reads a String representation of an e-mail message.
a raw message as a String
Returns 0 for success and -1 if an error occurred.
Sets the sender of the e-mail.
the sender of the e-mail.
Returns 0 for success and -1 if an error occurred.
Sets the subject of the e-mail.
the subject of the e-mail.
Returns 0 for success and -1 if an error occurred.
Copyright © 2022 OpenText Corporation. All rights reserved. |