Microsoft 365 Email Output

The Microsoft 365 Email Output task can send emails on behalf of any user in an organization's Microsoft 365 accounts, without having to specify that user's credentials. This way privacy is maintained while allowing a process to send email messages and attachments on behalf of any user. The task communicates through HTTPS. However, the real protection scheme (like certificates) is configured in Azure Active Directory by the IT administrators.

Note that this task doesn't merge data records with a PReS Connect template, like the Create Email Content task does.

This task uses the Microsoft Graph API.
For this task to function correctly, Workflow needs to be granted application permissions for Microsoft Graph in the organization’s Azure instance.
It needs read access to the Users category (User.Read.All) so that the task can identify the users in the organization.
In addition, to send emails on any user’s behalf, the Mail.Send permission is required, and in some circumstances the Mail.ReadWrite permission.

For more information on setting application permissions for Microsoft Graph, see https://docs.microsoft.com/en-us/graph/auth-v2-service.

Input

Any data file.

Processing

The task uses the Microsoft Graph API to access accounts in the organization (subject to that organization's IT policies).

While an email is always sent by this task (or at least attempted to be sent), the contents of the email and presence of attachments depends on the selected options.

Once the contents of the email and attachments are determined, the email (including any attachments) is sent directly to the selected mail server.

Note that the Windows instance's language setting may affect the output of this plugin. For example, a Workflow setup configured on a Windows-1252 machine will not be able to write Japanese strings. It won't affect the contents of attachments, since they are loaded as binary streams.

Note: The MS Graph REST API is limited to a certain number of requests within a certain period of time. This is called throttling. When throttling comes into play, the plugin receives HTTP response 429. The plugin will log the error and retry, but it exits with an error after 15 unsuccessful attempts.

Output

This task doesn't have any output other than the email that is sent to the recipient(s).

Task properties

General Tab

Nearly all of the fields on this tab are variable property fields, which means the values may change with each job at run-time. You can use any combination of text, variables and data selections; see Variable task properties.

Message information

Note: When specifying multiple recipients for the To, CC and BCC fields, separate the e-mail addresses with semi-colons (;).

  • To: Enter the email address(es) of the recipient(s).

  • Cc: Specify addresses to which a copy of the generated emails are to be sent.

  • Bcc: Specify discreet addresses (other recipients will not be able to see these addresses) to which a copy of the generated emails are to be sent.

  • Subject: Enter the subject of the email. Note that if you use a data selection in this field, you must be sure that the data that will be selected at run-time will not contain any parentheses, as this would cause the task to fail. If you suspect that the data may contain parentheses, you should use a Run Script action task (see Run Script) with a Strip() function to strip them out.
  • Message: Enter the content of the email message. This may be text or HTML based.
    Note that since this is a variable property field, its content is parsed at run-time. If HTML code is entered or pasted in this box, percent (%) and slash (/) HTML characters must be doubled, otherwise they will be disregarded.

    Note: Different email clients have different support for various features, especially with HTML emails (see HTML Email challenges in the PReS Connect Online Help). In most cases, if you want to send your email as an HTML message, your very first line should start with <html> or <!doctype html>. It should not be any other character.
    PReS Connect has a tool to design HTML email templates: the Designer. To generate email output from a template you would use the Create Email Content task.

    Also note that it is currently not possible to send both an HTML and plain-text version of your message with the Microsoft 365 Email Output task.

Attachments

Use this tab to specify what files to attach to the e-mail.

  • Attach input job file: Select to attach the current job file to the email that the task sends.

  • Rename to: Check this option to rename the job file before attaching it to the email, and enter a name.

  • File: Select additional or more additional files to include as attachments. Enter the file name, or use the Browse button to navigate and select the file. To add the file to the list of files to attach, click the Add file to Attach list button (the downward pointing arrow).

  • List of files to attach: Lists the files that will be attached to the email. Selecting the Attach output file(s) option adds these files at the top of the list. Any other file that may have been added using the File box (above) is also listed here.
    To remove a file from the list, select it, then right-click and select Remove from the list.

Note: The maximum size of an attachment is 150 MB. However, depending on network quality and server congestion, large data files can cause errors in some cases.

Connection

  • Application ID: Enter the application ID provided by Azure for this specific application. This value is static and cannot contain variables.

  • Application Password: Enter the client secret (key) for the Azure app. This value is static and cannot contain variables.

  • Tenant ID: Enter the Tenant ID as specified in Azure. This value is static and cannot contain variables.

  • User ID: This is the user's ID or email address. This value is dynamic and may include variables.

  • Use delegated permissions: Select this option to use delegated permissions instead of application permissions. Delegated permissions allow the application to log in as a standard registered user, and IT can grant that user account access to specific inboxes and specific OneDrive folders.
    Application permissions can be restricted to a strict minimum to ensure the plugin can perform its tasks, but no more. However, application permissions apply to all accounts in the organization: if the application has been granted permission to read emails, then that permission applies to all email accounts in the organization, and if it has access to OneDrive, it has access to all folders.

Advanced properties

To get access to the following properties tabs, right-click the plugin in the process and select Advanced Properties.

On Error Tab

For a description of the options on the On Error tab see Using the On Error tab.

Miscellaneous Tab

The Miscellaneous tab is common to all tasks.

It contains a text area (Task comments) that lets you write comments about the task. These comments are saved when the dialog is closed with the OK button and are displayed in The Task Comments Pane.

Check the option Use as step description to display the text next to the icon of the plugin in the Process area.

The tab also provides an option to highlight the task in The Process area with the default color, set in the Preferences (see Colors), or the color selected or defined under Highlight color on this tab.
To revert the selected highlight color to the default color, open this tab, turn the Highlight option off and close the dialog with the OK button; then turn highlighting back on.
Highlighting can also be turned on and off via the task's contextual menu and with the Highlight button on the View ribbon.