Sending email from Azure

Do we support sending email from an Azure service, similar to AWS SES? (eg. Sending emails with AWS SES)

There is no out of the box C3 AI Suite support for sending email from an Azure service. In fact, I’m not sure such as service exists.

A simple workaround is to implement a small method in python to send emails via SMTP. I’ve prototyped such a method in python and it worked well with Microsoft Outlook.

Here’s the .c3doc file that @brian.gerhold wrote that is in the 7.9 Release Branch, though not all organizations have the ability to use a third party plug-in like MailJet or SendGrid, so Scott’s SMTP solution is the most generic:

Title: Email from C3 through Azure
Category: Cloud Resources
Abstract: How to configure C3 and Azure to send emails from C3

What is Azure Email on C3

The C3 platform is capable of sending email through an Azure environment. Email can be sent on behalf of C3, or on behalf of your organization.

How it works / details

The Azure platform does not offer a native email service analogous to Aws Ses.
To enable email on Azure through C3, set the TenantConfig value “EmailSendMode” to “local”.

As of November 2017, Azure restricts emails to external domains

Azure email configuration can vary by account type:
Enterprise Agreement customers are not restricted and may send email over port 25 from their VM instances.
It is possible for C3 to send email from such VM instances, but customers should be aware that email through such a VM has a high chance of being trapped by SPAM filters.

Other Azure customers must use a 3rd-party secured mail relay. The most common vendors on Azure are:

  1. SendGrid
  2. MailJet

Getting started

The Azure account used for VM-instance provisioning must be configured to enable emails to external domains.
This is done by the operations team which controls the relevant account - sometimes the account is controlled by C3, sometimes by C3’s customer.
Selection of 3rd-party email relay is up to customer discretion:

  1. SendGrid
  2. MailJet

C3 must also be configured with “EmailSendMode” {@link TenantConfig} set to “local”.
This can be accomplished a few different ways:

  • Via the console:
TenantConfig.putConfig('EmailSendMode', 'local')
  • Via seed data TenantConfig/EmailSendMode.json:
{
  "id" : "EmailSendMode",
  "name"  : "EmailSendMode",
  "value" : "local"
}

Once these configurations are effective, use the {@link Mail} type to send email (see Examples).

Examples

Send email with {@link Mail}:

var myMail = Mail.make({
 from : "from.address@youcompany.com",
 to : ["to.address1@somewhere.org","to.address2@somewhere.org"],
 content_type : "text/html",
 subject : "Email subject here",
 content : "Email body here" 
}).upsert();
Mail.send(myMail)

Limits

C3’s ability to send email on Azure is completely dependent on correct Azure account configuration

API Reference

For Azure mail config, see SendGrid and
MailJet

For C3 config, see {@link TenantConfig}
For C3 mail api, see {@link Mail}

Related Topics

  • {@link aws_email.c3doc Email from C3 through AWS SES}
1 Like