Developer documentation
Back to index

Sending email through another mail server

Although using our mail server is free and reliable, using your own mail server gives you more control over the contents of your mails. If you want to use your own “From” address then using your own mail server can make delivery more reliable.

Why use another mail server?

  • Prevent showing references to SuperSaaS. You can configure your account to send mail with your own “From” address. However, the system will display a “Resent-From” header with our mail server unless you add our mail server in the SPF record in your DNS (see below). You may not have control over the content of the DNS records, and by using your own mail server you have full control over the contents of the mail, including the headers.
  • Avoid delivery problems. Your mail provider or IT department may have set spam prevention measures that make it difficult to send mail from a third party mail server. For example, some mail servers are configured to reject any mail with a “From” address of a domain it considers to be its own. Similarly, your domain may have so-called “SPF” or “DKIM” records configured in your DNS that prevent third parties from sending mail, and you may not be in a position to change those.
  • Keep track of sent mails. Some mail servers, such as Gmail, allow you to keep a copy of all sent emails which can be useful if you need to keep track of what got sent to whom.
  • Add mail analytics. You can use a service, such as Mandrill, that adds tracking links and “invisible pixels” to emails to be able to keep track of whether the email was opened.

Configure a webhook to intercept mail

You can either configure a “Send Mail” webhook that triggers each time a mail is generated or you can configure a webhook only on a specific action such as a “New appointment”. The “Send Mail” webhook will give you an entirely formatted mail and a list of email addresses that you can use to send yourself directly. The other webhooks will give you access to the object that triggered the webhook, and you have to construct the email yourself. The information on this page assumes that you want to redirect all your mail to another server. If you want to send an email for only one specific action then see the information on other webhooks.

As soon as you set a “Send Mail” webhook that triggers on all mail, all mail sending from your account by our server will automatically be suspended. Other webhook triggers do not affect mails sent by us.

You can use Zapier or Make to set up webhooks, or you can configure them yourself using the custom webhooks screen inside your SuperSaaS account. See the quick setup example using Mandrill if you just want to get something working quickly.

Send mail to a third party via Zapier or Make

The output of SuperSaaS’ webhooks may not be compatible with the input that the API of a third party mail service expects. Or an API may need an authentication sequence before it can be used. You can use either or (formerly known as Integromat) to set up a webhook by simply matching the fields without the need for any programming. This allows you to set up a webhook to redirect your email through Gmail, Google Apps, SendGrid, or a number of other mail providers with very little effort.

As soon as you activate a “zap” or webhook, sending mail from our server will be suspended, it will resume when all mail webhooks are paused or deleted.

Send mail using a custom webhook

Please note that custom webhooks are only available to SuperSaaS subscribers. You can try it out for a week by clicking the button “Start free trial” on the webhooks screen.

You can set up webhooks on the Webhooks screen inside your SuperSaaS. After you enter a URL endpoint to create a webhook you can edit the payload it will send when triggered. By default, the payload contains a JSON encoded message that contains all information needed to reconstruct and send a message on the receiving end, use the “Test webhook” link to see an example. You can refine what information gets sent by clicking the Custom option and building the JSON yourself. The JSON can contain magic words, which will be replaced with JSON encoded values as described in the following table.

Magic wordResult (JSON encoded)
$toAn array of email addresses for the “To” field
$bccAn array of email addresses for the “BCC” field
$recipientsAn array of all email addresses, both “To” and “BCC”
$plainPlain text contents of the message, if any
$htmlHTML contents of the message, if any
$bodyHTML or plain text contents of the message depending on content type
$content_typeContains ‘html’ or ‘plain’ depending on the message type
$rawMIME encoded version of the entire message including attachments
$attachmentContains the attachment, if any

For privacy reasons, reminder emails with multiple recipients are sent by SuperSaaS with addresses in the BCC field and an empty “To” field. If you send group reminders this can pose a problem for APIs that expect the “To” Field to contain something. A workaround can be to put both $bcc and $to addresses in “To” field using the $recipients variable, and set up the mail program to hide multiple recipients in outgoing emails.

Example: Sending mail via MailChimp

MailChimp offers a service that specializes in transactional email delivery, formerly called Mandrill. They provide advanced features like click tracking.

Create an API key in Mandrill

Sign up for a Mandrill account, go to the Settings screen in Mandrill and click the button + New API Key. Copy the generated key to your clipboard.

Redirect mail from SuperSaaS to Mandrill

Go to the Webhooks screen inside your SuperSaaS account to create a new webhook. In the box “Trigger” select the option “Send Mail” and in the box “Target URL” put this URL:
Click Create Webhook. Next you will see the “Edit Webhook” screen where you can select the Custom option and enter the following JSON snippet:

  "key": "MANDRILL_API_KEY",
  "raw_message": "$raw",
  "from_email": "",
  "from_name": "Your Name",
  "to": "$recipients"

Replace MANDRILL_API_KEY with the key you generated in the previous step, edit from_email and from_name as appropriate and click “Update webhook”. To try it out you can click the edit icon and “Test webhook” and then modify the payload to have a valid email address. You can, of course, also perform an action on your schedule that generates an email.

Finally, check the “Outbound” screen in your Mandrill account to check it got delivered properly. You may also want to read Mandrill’s documentation on setting up SPF and DKIM on your domain to improve the reliability of getting past spam filters.