emailutils
Web icon

EmailUtils

Stable version 1.1.0 (Compatible with OutSystems 11)
Uploaded
 on 19 November 2023
 by 
5.0
 (1 rating)
emailutils

EmailUtils

Documentation
1.1.0

The EmailUtils component includes utility actions and widgets for parsing and displaying email content in MIME format.

Use this component to display emails sent from OutSystems, emails read from an email server, or any email in MIME format.

The component uses the MailKit library at https://github.com/jstedfast/MailKit


Contents

  • Scenarios
  • Actions
  • Widgets
  • Team Membership Agreement



Scenarios

#1 Build a screen to display OutSystems outgoing emails

Query the System Sent_Email entity for email metadata and the Email_Content entity for the email in MIME format.

Use the EmailUtils_ParseEmail action to retrieve the email HTML content and attachments. Set StripAttachmentContent to True, so only attachment metadata is returned. Set ConvertInlineImages to True so images will display in the HTML content.

Display the email HTML content using the IsolateHtmlBlock web block.

#2 Parse email content and store email content

Create entities to store email metadata and email content.

When email content is provided either via upload or a REST API, parse email content using the EmailUtils_ParseEmail action and store the email metadata and content in the entities.


For example usage a demo is available on the sample page.


Actions

The EmailUtils component exposes the following actions.


EmailUtils_ParseEmail

Parse an email in MIME format. Provide the binary email content in MIME UTF8 format. The email details and attachments will be returned.

Parameters

EmailContent (Binary Data): Email content in MIME/UTF8 format

ParseAttachments (Boolean): Parse and return attachments

StripAttachmentContent (Boolean): If ParseAttachments is True and StripAttachmentContent is True attachment details will be returned without the attachment content.

ConvertInlineImages (Boolean): For HTML emails, convert embedded images to inline HTML images for ease of display. This however duplicates the image content if the image appears multiple times.

(Out) Email (EmailUtils_Email Record): The parsed email.


EmailUtils_ParseEmailAttachments

Parse and return attachments. Parse an email in MIME format and retrieve only the attachments with content.

Parameters

EmailContent (Binary Data): Email content in MIME/UTF8 format

(Out) Attachments (EmailUtils_Attachment Record List): A list of attachments


EmailUtils_ParseEmailGetAttachment

Parse the email and retrieve the specified attachment

Parameters

EmailContent (Binary Data): Email content in MIME/UTF8 format

ContentId (Text): The attachment content id

(Out) Attachment (EmailUtils_Attachment): The attachment details and content.


Widgets

IsolateHtmlBlock

Isolate HTML by displaying in a shadow DOM, if supported. The shadow DOM prevents styles in the HTML content from affecting the rest of the page.
If shadow DOM is not supported, the HTML is displayed in a DIV.
Script elements are removed from HTML.
Warning! Passing uncontrolled HTML could still result in security risks.


Structures

EmailUtils_Attachment

An email attachment

Attributes

ContentId (Text): Attachment content id

ContentType (Text): Size of the attachment in bytes.

ContentSize (Integer): Size in bytes of the attachment.

Content (Binary Data): The attachment content.

Filename (Text): The attachment filename.

IsInline (Boolean): If True, the attachment is an embedded object otherwise a normal attachment.


EmailUtils_Email

An email message

Attributes

MessageId (Text): The email message id

Date (DateTime): The date and time the email was sent

From (Text): The from email address

To (Text): The to email address

Cc (Text): The CC email address

Subject (Text): The email subject

BodyText (Text): The email body text, if HTML, the text stripped of HTML content.

BodyContent (BinaryData): The email body content in UTF8 encoding. If ContentType is text/plain then the content is just text, otherwise if text/html the content is HTML.

ContentType (Text): The content type of the BodyContent

Attachments (EmailUtils_Attachments Record List): Attachments

Importance (Text): Low, Normal or High

Sender (Text): The sender may differ from the addresses in From if the message was sent by someone on behalf of someone else.

Priority (Text): NonUrgent, Normal or Urgent

References (EmailUtils_MessageId Record List): The References header contains a chain of Message-Ids back to the original message that started the thread.


EmailUtils_MessageId

An email message identifier

Attributes

MessageId (Text): The message identifier.



1.0.0

The EmailUtils component includes utility actions and widgets for parsing and displaying email content in MIME format.

Use this component to display emails sent from OutSystems, emails read from an email server, or any email in MIME format.

The component uses the MailKit library at https://github.com/jstedfast/MailKit


Contents

  • Scenarios
  • Actions
  • Widgets
  • Team Membership Agreement



Scenarios

#1 Build a screen to display OutSystems outgoing emails

Query the System Sent_Email entity for email metadata and the Email_Content entity for the email in MIME format.

Use the EmailUtils_ParseEmail action to retrieve the email HTML content and attachments.  Set StripAttachmentContent to True, so only attachment metadata is returned.  Set ConvertInlineImages to True so images will display in the HTML content.

Display the email HTML content using the IsolateHtmlBlock web block.

#2 Parse email content and store email content

Create entities to store email metadata and email content.

When email content is provided either via upload or a REST API, parse email content using the EmailUtils_ParseEmail action and store the email metadata and content in the entities.


For example usage a demo is available on the sample page.


Actions

The EmailUtils component exposes the following actions.


 EmailUtils_ParseEmail

Parse an email in MIME format.  Provide the binary email content in MIME UTF8 format.  The email details and attachments will be returned.

Parameters

EmailContent (Binary Data): Email content in MIME/UTF8 format

ParseAttachments (Boolean): Parse and return attachments

StripAttachmentContent (Boolean): If ParseAttachments is True and StripAttachmentContent is True attachment details will be returned without the attachment content.

ConvertInlineImages (Boolean): For HTML emails, convert embedded images to inline HTML images for ease of display.  This however duplicates the image content if the image appears multiple times.

(Out) Email (EmailUtils_Email Record): The parsed email.


EmailUtils_ParseEmailAttachments

Parse and return attachments. Parse an email in MIME format and retrieve only the attachments with content.

Parameters

EmailContent (Binary Data): Email content in MIME/UTF8 format

(Out) Attachments (EmailUtils_Attachment Record List): A list of attachments


EmailUtils_ParseEmailGetAttachment

Parse the email and retrieve the specified attachment

Parameters

EmailContent (Binary Data): Email content in MIME/UTF8 format

ContentId (Text): The attachment content id

(Out) Attachment (EmailUtils_Attachment): The attachment details and content.


Widgets

IsolateHtmlBlock

Isolate HTML by displaying in a shadow DOM, if supported.  The shadow DOM prevents styles in the HTML content from affecting the rest of the page.
If shadow DOM is not supported, the HTML is displayed in a DIV.
Script elements are removed from HTML.
Warning! Passing uncontrolled HTML could still result in security risks.


Structures

EmailUtils_Attachment

An email attachment

Attributes

ContentId (Text): Attachment content id

ContentType (Text): Size of the attachment in bytes.

ContentSize (Integer): Size in bytes of the attachment.

Content (Binary Data): The attachment content.

Filename (Text): The attachment filename.

IsInline (Boolean): If True, the attachment is an embedded object otherwise a normal attachment.


EmailUtils_Email

An email message

Attributes

MessageId (Text): The email message id

Date (DateTime): The date and time the email was sent

From (Text): The from email address

To (Text): The to email address

Cc (Text): The CC email address

Subject (Text): The email subject

BodyText (Text): The email body text, if HTML, the text stripped of HTML content.

BodyContent (BinaryData): The email body content in UTF8 encoding.  If ContentType is text/plain then the content is just text, otherwise if text/html the content is HTML.

ContentType (Text): The content type of the BodyContent

Attachments (EmailUtils_Attachments Record List): Attachments

Importance (Text): Low, Normal or High

Sender (Text): The sender may differ from the addresses in From if the message was sent by someone on behalf of someone else.

Priority (Text): NonUrgent, Normal or Urgent

References (EmailUtils_MessageId Record List): The References header contains a chain of Message-Ids back to the original message that started the thread.


EmailUtils_MessageId

An email message identifier

Attributes

MessageId (Text): The message identifier.



Team Membership Agreement

As a member of this team, I agree to abide by the following rules:

  • All communication between developers and users is polite, constructive and in good faith,
  • New features are listed on the roadmap (in plugin documentation) and announced to the team before work begins,
  • Any disagreements about a feature must be resolved before a change is published,
  • New features in extensions are unit tested in the extension,
  • New versions are tested by the developer before being published,
  • New versions are published in "Under Development" status until a team member has given it a successful test before being changed to "Stable",
  • Any new teams members must agree to the ground rules.  If a team member is not able to follow the ground rules, they must leave the team.