Email Integration
Cloudomation Engine can send and receive emails.
Use Cases
With the email integration you can:
- Send notifications about the status of an automated process.
- Start an execution for each incoming email.
- Add email approval steps to your automation processes.
Concept
Receiving Emails
Engine can receive emails from any IMAP server using the IMAP connector. See also the Connector Type IMAP documentation.
Engine currently only supports polling the IMAP server for messages. Push notifications are not currently implemented.
Sending Emails
There are two ways to send emails:
- Through any SMTP server using the SMTP connector. This method allows to send to any email address. See Connector Type SMTP.
- Through the SMTP integration. Using this method is simpler, but emails can only be sent to the email addresses of existing Engine user accounts in your workspace. See send_mail().
To send an email to yourself:
import flow_api
def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
system.get_own_user().send_mail(
'This is a test email to me',
html='<h1>Heading</h1><p>This is a paragraph</p>'
)
return this.success('email sent')
The send_mail
method sends emails from info@cloudomation.com to the email
address of the user. On premise installations need to configure an SMTP server
to use this feature. If none is configured cloudomation falls back to
writing a file with the email contents in the directory declared by the environment
variable "NOTIFICATION_PATH". The message will be displayed in the logs in
case this is also unconfigured.
Migrating to OAuth 2.0
If you use Gmail or Office 365 Outlook as your SMTP server, you need to migrate to OAuth 2.0 authentication if you haven't done so already. Support for basic authentication will be discontinued by Google and Microsoft in the future.
Here is how you can use OAuth 2.0 in your Engine email integration:
- Setting up the OAuth 2.0 client by following the respective instructions:
- Navigate to the workspace settings and set the following parameters:
SMTP_AUTHENTICATION_MODE
:XOAUTH2
,SMTP_OAUTH2_CLIENT_ID
:<created by you during the previous step>
,SMTP_OAUTH2_CLIENT_SECRET
:<created by you during the previous step>
- (only if you manage your Engine workspace) Authorize workspace access to the mailbox by running the Engine installer like this:
The setup will then guide you through the following steps:
setup.sh --smtp-oauth-authorize
- Open the link to the consent screen of Google/Microsoft provided by the setup,
- press accept,
- after accepting, you will be redirected to a page with the final authorization code,
- enter the the final authorization code into the setup.