There is no perfect documentatin of the Email setup on Mautic 5 as the setup depends on your SMTP, server speed and other factors. In this tutorial I’m trying to cover as much as can. Oh – I created a video for it!

By watching the following video you’ll get all the background information how email setup in Mautic 5 works, what is the DSN, and how to add the proper components to your Mautic to be able to send email and receive callbacks if anything bounces.

If you don’t have time or you don’t care how anything works, and just want to have a simpel answer, here are some key scenarios for setting up your DSN.

What is DSN?

It’s a combination of settings, where you can tell your email transport how to access your SMTP and pass some settings. Like: take a break between sending emails and such. For SMTP the DSN looks like this:

If you send via SMTP

You don’t need to install any new components, Mautic installs Symfony mailer, and it already supports this method (the symfony/mailer package). However there are no feedback loops via webhook, so you will have to set up bounce management by reading incoming emails.

Your settings page would look like this:

You can see the DSN being formulated into this format:

MAILER_DSN=smtp://user:pass@smtp.example.com:port

The advantages of the smtp transport is, that you can do couple of other cool things as well, here is a documentation to it.

You send via Amazon SES

For this transport you’ll need to install the symfony amazon api transport and/or a plugin that manages a webhook. In my video above I’m sharing all the information you need to choose the right components, and even have a comparison table of the current situation:

If you don’t have time to watch it, this is what you need to know:

  1. For sending an email via Amazon SES you need a Symfony component called “symfony/amazon-mailer”.
  2. For receiving webhooks you need one of the plugins mentioned above.
  3. But there is a plugin, that does both in one – etailors_amazon_ses, and I recommend you to install it. They really did an amazing job with this plugin.

The installation is simple, it goes in your plugins folder with the folder name AmazonSesBundle. Clear the cache, reload plugins and you are good to go.

sudo -u www-data php bin/console cache:clear
sudo -u www-data php bin/console mautic:plugins:reload

Using the DSN you’ll need the following setup:

Webhooks

Webhooks are managed via callback from SNS. If you don’t know how Amazon SES and Mautic needs to be set up, check this video. The only change in Mautic 5 is the callback URL, it depends on the plugin you choose. For this plugin you need the following format: https://subdomain.domain.tld/mailer/callback.

It will only work if you choose the proper DSN: mautic+ses+api !

Troubleshooting:

If you already installed the symfony/amazon-ses component via composer, you’ll need to remove it. You can do it by removing it via composer. If you installed a plugin, that is not the etailors plugin, then you’ll need to remove that as well. If the plugin you remove is also named AmazonSESBundle, you’ll need to manually delete the entry from the plugins table in your database upon uninstalling it.

You send via other transports

Please see what package is needed for sending a receiving webhooks for specific tranports:

ProviderPackageSMTPHTTPAPIFBL / Webhook?
GMAILn/agmail+smtp://USERNAME:APP-PASSWORD@defaultn/an/avia email
Mandrillsymfony/mailchimp-mailermandrill+smtp://USERNAME:PASSWORD@defaultmandrill+https://KEY@defaultmandrill+api://KEY@defaultn/a
Mailgunsymfony/mailgun-mailermailgun+smtp://USERNAME:PASSWORD@defaultmailgun+https://KEY:DOMAIN@defaultmailgun+api://KEY:DOMAIN@default
Mailjetsymfony/mailjet-mailermailjet+smtp://ACCESS_KEY:SECRET_KEY@defaultn/amailjet+api://ACCESS_KEY:SECRET_KEY@default
Postmarksymfony/postmark-mailerpostmark+smtp://ID@defaultn/apostmark+api://KEY@default
Sendgridsymfony/sendgrid-mailersendgrid+smtp://KEY@defaultn/asendgrid+api://KEY@defaulthttps://github.com/ilonamanole/MauticSendgridInboundBundle *
Sendinbluesymfony/sendinblue-mailersendinblue+smtp://USERNAME:PASSWORD@defaultn/asendinblue+api://KEY@defaulthttps://github.com/ilonamanole/MauticSendgridInboundBundle *
  • NEEDS MORE TESTING

Troubleshooting

  1. Wrong encoding
Failed to authenticate on SMTP server with username “myemail@mydomain.com” using the following authenticators: “LOGIN”, “PLAIN”. Authenticator “LOGIN” returned “Expected response code “235” but got code “535”, with message “535 Incorrect authentication data”.”. Authenticator “PLAIN” returned “Expected response code “235” but got code “535”, with message “535 Incorrect authentication data”.”.

You are using lower version then Mautic 5.1. This results in faulty encoding of your credentials. If you your password includes special characters, the login won’t work.

2. Signature match error

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

If you installed everything right, you just need to update your dependencies.

composer update

That will solve the issue

The second part

Setting up the email transport properly is just half of the story, you’ll need to make sure you run commands that actually send emails out.

See my blogpost about the whole process.

Tags:

2 Comment

  • Icke Me

    says:

    Hi Joey,

    thanks for all your great tutorials. Have you ever encountered the error message “Unable to send an email: There are 1 partial failures, check logs for exception reasons .” when trying to send a Test Email with the etailors plugin?

    If so, do you know what it means, and how to fix it, since there is nothing more in the logs…

    Thanks!

    Reply
  • Icke Me

    says:

    okay, I worked this out, and this might help anyone else:

    When saving the AWS Secret Access Key, the little lock icon actually gets saved as characters in the config file and breaks the API authentication. Not sure why that’s happening even when I delete that lock icon, but it happened.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *