Sunday, March 2, 2014

Sending Email from BlueBox with Mandrill

Mandrill.com (the platform/infrastructure behind Mailchimp.com) offers a powerful email sending solution for outbound emails. It can be very helpful for mail tracking (opens and clicks) and having some control over your outbound email messages.

In BlueBox we have recently added additional email settings to the bb_email module which allow you to configure your system to use Mandrill as the outbound mail server.

Setting up your Mandrill.com account:

Firstly you need to set up your Mandrill account. The free account comes with 12000 free emails per month. Within your account you can set up 2 control mechanisms to separate 'who is sending the messages' and thereby have one account for all your sites/customers if you have more then one BlueBox server to manage:
  • API Keys > these are essentially the 'passwords' used for sending outbound messages. You can have multiple keys and so using this method can control who is sending which messages.
  • Sub accounts > these are more detailed and offer more control, and can be used in conjunction with a key to for a true sub account for the customer/sender complete with mail limits etc.
Setting up your BlueBox system:

To set these go to Admin > Modules > Module Settings and select 'bb_email' as the module/class.

You will then see a set of bbsettings which can be configured, namely:
  • bbsetting_email_from_name
    (This setting overrides the same setting in the config file if set.)
  • bbsetting_email_from_email
    (This setting overrides the same setting in the config file if set.)
  • bbsetting_email_smtp_server
    smtp.mandrillapp.com
  • bbsetting_email_smtp_port
    587
  • bbsetting_email_smtp_username
    (your Mandrill username, normally your email)
  • bbsetting_email_smtp_password
    (the API key generated on Mandrill, see above)
  • bbsetting_email_smtp_security
    tls
  • bbsetting_email_smtp_headers
    X-MC-Subaccount=(subaccount_name),X-MC-Track=Opens|Clicks,
Note that for the last setting, bbsetting_email_smtp_headers, these are optional, and there is a pipe | between Opens and Clicks because commas are reserved for BlueBox bbsetting array separators.

Updating the DNS records for the 'from domain':

Because the emails are being sent from Mandrill.com's platform we need to tell the DNS network that they are authorised to send emails 'as' our 'from domains' - so for each from domain you should ideally edit it's DNS records and set the DKIM and SPF records in the TXT section of the DNS record. This is really quick and easy to do - simply follow the instructions on the Mandrill control panel and you have them set in a minute.

No comments:

Post a Comment