Configuring Mautic email transports with a DSN

Mautic sends its email through a Symfony Mailer DSN string. This page explains how to build it, choose ports 465, 587 or 25, encode credentials and test before any campaign goes live.

On this page

How Mautic's mailer DSN controls every outbound email

A Symfony Mailer DSN is the single connection string that tells Mautic how to hand outbound email to a sending service, and it is the first delivery setting to get right because nothing else in the sending path works until it does. If your self-hosted instance cannot send yet, or your team is about to launch campaigns, start by confirming which transport you will use and that the DSN for it is saved and accepted. Mautic is written in PHP on the Symfony framework, and its mailer uses the Symfony Mailer DSN format, so the scheme, credentials, host, port and options you enter follow Symfony's conventions rather than anything Mautic-specific.

The transport you choose sets more than the connection itself. SMTP and API-based transports differ in how they handle bulk sending, whether they report bounces, complaints and other callbacks back to Mautic, and how they authenticate the sending domain. Those differences shape later decisions about batching, unsubscribe handling and DNS records, so record the chosen provider and the features you need from it before you copy credentials into the configuration. Confirm with your provider which features its Symfony transport supports and which ones depend on a Mautic transport plugin.

The DSN is only one part of the sending path. Mautic depends on cron jobs for segment and campaign updates and triggers, plus a broadcasts command for segment emails, and it needs a messenger consumer running when emails are queued. A correct DSN with no running consumer can look like a broken mailer, and a running consumer with a wrong DSN fails silently in the queue. Plan the test so it exercises both: send a message through the queue path from a real campaign or broadcast to a test contact, then check the delivery result on the provider side.

How a Mautic email travels from the DSN to the recipient

The path starts when a campaign or broadcast creates messages. Cron jobs and the broadcasts command feed the queue, and the messenger consumer hands each message to the mailer. The mailer is built from the Mailer DSN, which carries the transport credentials, so that DSN and its secrets form the trust boundary. Check each hand-off separately: the queue is draining, the DSN parses with encoded credentials, and the provider accepts the message before you launch a campaign.

Mautic hands each queued message through the DSN-configured mailer to the provider.

Which transport scheme and port fits each sending setup

This table compares the common ways Mautic's mailer can reach an outbound server, from implicit TLS on port 465 and STARTTLS on port 587 to plain port 25 and API transports. Read each row by asking what your mail provider or relay offers, then confirm the exact DSN scheme and parameters against the Symfony Mailer version bundled with your Mautic release.

SetupTypical choiceWhy it is chosenWhat to confirm
Provider with SMTP credentialsSMTP over implicit TLS on port 465Encryption starts at connection, so no plaintext negotiation happens before TLSProvider documents port 465 and the DSN scheme for implicit TLS in your Symfony Mailer version
Provider or relay offering SMTP submissionSTARTTLS on port 587Connection starts in plain text, then upgrades to TLS; widely offered by hosted relaysProvider requires STARTTLS and the DSN encryption option is set accordingly
Local or internal relay on a private networkPort 25 without public exposureOften used by on-premises mail servers that accept unauthenticated relay from trusted hostsRelay allows the Mautic server's address and whether TLS or auth is required
Public internet delivery on port 25Avoid for outbound submissionMany hosting networks and residential ranges block outbound port 25 trafficYour hosting provider's outbound port policy before you choose this route
API-based provider sending one email per requestSymfony API transportUses the provider's HTTP API instead of SMTP, with its own keys and endpointsBatching and callback behavior are covered in the sibling API transport topic
DSN authenticationAuth mode and credentials in the DSNSets how the username and password are presented to the server, and must match the relay's requirementsAccepted auth mode names and URL encoding of special characters in passwords
DSN encryption and local optionsEncryption and local parameters in the query stringControls TLS behavior and the local name announced to the server, which some relays checkExact parameter names, defaults and accepted values for your bundled Symfony Mailer version

Setting up the Mautic mailer DSN step by step

This sequence takes a Mautic instance from a confirmed release and PHP version to a verified test message delivered through a configured transport. Each step ends with a check so the team knows the mailer works before any campaign depends on it.

  1. Confirm the Mautic release and PHP version

    Check the Mautic version you are running against the PHP versions it supports before touching mailer settings. Mautic 7.0 requires PHP 8.2, 8.3, 8.4 or 8.5, so confirm the PHP runtime on the web and worker hosts matches. Also confirm the release line is still under security support on the Mautic releases page, since a mailer change on an unsupported line creates work you will repeat at upgrade time. Done when the version and PHP output from the server match a supported combination.

  2. Collect credentials from your email provider

    Ask the email provider for the connection method your account uses, either SMTP credentials or an API key, along with the exact host, port and encryption mode it documents for your account. Store the username, password or key in your secrets manager, not in a ticket or chat thread. Confirm which sending domain the provider expects in the From address, because mismatches are a common cause of rejected sends. Done when you hold the full set of values and have written down the host, port and encryption setting for later comparison.

  3. Build the DSN with URL-encoded credentials

    Assemble the Symfony Mailer DSN from the scheme, user, password, host, port and any options the provider requires. URL-encode the user and password so characters such as @, : and / do not break parsing. Use port 587 with STARTTLS or port 465 with implicit TLS where your provider documents them, and treat port 25 as a setting to confirm with the provider because many hosts block it for outbound mail. Test the encoding in a local shell before you paste it into configuration. Done when the DSN parses cleanly and the test shows the expected host and port.

  4. Enter the DSN in mailer configuration

    Place the DSN in the mailer settings in Mautic or in the environment configuration your deployment uses, and keep the file permissions restricted to the service account. Avoid editing the value in several places, because a stale copy on a worker host sends mail through the old settings. Restart or clear the cache as your installation requires so the new value is loaded. Done when every web and worker node reports the same transport value.

  5. Set the from address and transport options

    Set the from address and name to a sending domain you control and have authenticated with SPF, DKIM and DMARC. Confirm the provider options that control tracking, click handling and any reply behavior, and record each choice so the team can explain it during a review. If you plan to send as contact owners, note that this changes the From address and the domains that need records. Done when the from address and options are saved and documented alongside the DSN.

  6. Verify the queue and cron are running

    Confirm the cron jobs that Mautic depends on are scheduled and staggered, and that the messenger consumer is running if emails are queued. Check the logs for the most recent runs and for any error from the mailer or the queue worker. A message sent while the consumer is down can sit in the queue and look like a transport failure. Done when the consumer and cron entries show recent successful runs and the queue is not backing up.

  7. Send a test message to seed mailboxes

    Send a test email to a set of mailboxes you control across at least two providers, including one corporate and one consumer address, and read the full headers at the receiving end. Check that the From, Message-ID, authentication results and List-Unsubscribe header match your design, and that the message lands in the inbox rather than spam. Review the Mautic mailer error log for any warning even when the message arrives. Done when the test arrives with the expected headers and authentication results, and the log is clean before any campaign is scheduled.

Why special characters in passwords break the DSN

A Symfony Mailer DSN is a single URL, so every credential inside it has to follow URL rules. The username, API key and password must be percent-encoded before they go into the string. Characters that have a structural meaning in a URL, such as the at sign, colon, slash, hash, question mark and percent sign itself, are read as delimiters if they appear raw. A password containing an at sign, for example, causes the parser to split the string at that point, so the host the mailer connects to becomes part of the password and the connection fails with an authentication or host error that looks unrelated to encoding. The safe habit is to encode each credential value on its own, using a standard URL encoding function from your language or shell, and never to hand-edit a DSN that already contains a credential.

To test encoding without exposing the secret, avoid printing the DSN or pasting it into tickets, chat or logs. Instead, decode the parsed parts in a throwaway local script or a short-lived shell session on the Mautic host, check that the username and password come back exactly as the mail provider issued them, and confirm the host and port fields are the ones you expect. Then send one test message to an internal mailbox through the transport, as described later in this topic. Ask your provider or the team that issued the credential to confirm whether it allows special characters at all. Many teams avoid the problem by generating a long, alphanumeric API key or SMTP password, which removes the need for encoding entirely.

Treat the DSN as a secret. Do not commit it to version control, including a .env or local configuration file that is tracked by Git, and do not place it in a shared template, a Composer project file or a ticket attachment. Keep the value in the environment or secrets store of the host that runs Mautic, restrict who can read that store, and rotate the credential if a DSN is ever exposed. Add a scan for credential patterns to your repository checks so a leaked value is caught before it is pushed. If your organization already manages application secrets centrally, store the DSN there and reference it at deploy time rather than copying it into server files by hand.

Protecting the DSN, credentials and sending path

The DSN contains the credentials that let Mautic send mail, so it carries the same risk as any sending key. The cards below cover where the DSN lives, how access is limited, how it is rotated and how the sending path is kept tight, so a leaked value cannot be used to send mail under your domain.

Keep the DSN out of the config file

Mautic reads the mailer DSN from its environment configuration, so the value should be injected from environment variables or a secrets manager you control rather than typed into a file that gets copied between servers. Check who can read the web root, the backup archives and the deployment pipeline, because each of those can expose the same string. Confirm the exact variable names your Mautic release expects in its configuration documentation before you wire anything up.

Install docs

Use one credential per instance

Create a separate SMTP user or API key for each Mautic instance, and for each sending domain if you run more than one. Scope the key to sending only, with no access to the provider console, billing or suppression management where the provider allows that split. If one instance is compromised, you can revoke its key without breaking production mail from the others. Ask your transport provider how it limits sending per key.

Rotate keys after staff changes

Anyone who has seen the DSN, including former administrators and contractors who set up the first transport, should be treated as holding a live credential. Rotate the key whenever someone with access leaves or changes role, and after any suspected exposure. Schedule the rotation so the new DSN is deployed and tested before the old key is revoked, so campaigns are not interrupted. Record the owner and the rotation date beside the credential.

Enforce TLS on every connection

Require an encrypted connection between Mautic and the transport endpoint. For SMTP, port 465 uses implicit TLS from the first byte, while port 587 starts in plain text and upgrades with STARTTLS, so confirm the DSN options and the provider's requirements instead of assuming the upgrade happens. Do not disable certificate verification to get a test working, because that exposes the credentials to anyone on the network path. Test the connection with the certificate chain your mail provider presents.

Restrict outbound SMTP from the host

Limit the Mautic server so it can open outbound connections only to the mail endpoints it uses, and to the database and other services it needs. Many hosts can reach port 25 on any destination, which lets a compromised web application deliver spam directly and bypass your provider's controls. Ask your hosting or network team to confirm egress rules for the chosen port, and log denied attempts so a misconfiguration is visible.

Keep the DSN out of logs

Mailer errors, debug output and application logs can echo the full connection string, including the password embedded in the URL. Review the logging level used for the mailer, the web server access log and any log shipper that collects them, and redact the credential portion before logs leave the host. Test by triggering a deliberate authentication failure and searching every log destination for the password. Percent-encoded characters in the DSN still reveal the secret, so redaction must cover the encoded form.

Questions teams ask before configuring the Mautic mailer

What drives the cost and effort of configuring a Mautic mailer?

The effort depends mostly on how many sending paths you need and how much of the environment you control. A single transport for one sending domain with a known provider is a small task. Costs rise with multiple transports, API-based providers that need plugins, extra sending domains, server-side mail relay work, and testing across staging and production. Your own costs include the email provider subscription, DNS changes and staff time. A written scope should list the transports, domains, environments and test cases, and state what is one-time and what recurs, such as provider fees and upgrade testing.

Can an internal team configure the Mautic mailer without outside help?

Yes, a team with server administration and DNS skills can usually do it, provided it understands SMTP authentication, TLS and port choices. The work is not large, but mistakes are easy to make and hard to see, because a misconfigured transport can fail silently until a campaign runs. Teams without that experience often benefit from an outside review of the DSN, the test results and the logs before campaigns go live. Whichever route you choose, ask for the test evidence in writing.

What does the work need from our side before it starts?

Plan to provide four things before work begins:

  • An account with your chosen email transport provider, with SMTP or API credentials that can be rotated.
  • DNS access to the sending domain so records can be checked and changed when needed.
  • Access to the Mautic server or its environment variables, plus a staging instance where tests can run first.
  • Test mailboxes across the major providers you email, and a named person who approves sends.

Without these, testing stalls. Confirm who holds each credential and how it will be stored.

How long does testing a Mautic mailer usually take?

Testing is best described in stages rather than fixed days. First, the DSN is verified on the server with a single test message. Second, authentication and headers are checked on delivered messages. Third, bounces, failures and provider callbacks are confirmed. Fourth, a limited send to internal test contacts runs before any live campaign. Each stage can repeat if a fix changes the configuration. The duration depends on provider approval, DNS propagation and how many transports you test, so ask a provider to state its stages and exit criteria in the scope.

Why is port 25 often a poor choice for Mautic email?

Port 25 is the port servers use to relay mail between mail systems, and many hosting providers and cloud networks block outbound traffic on it to limit spam. Even when it is open, it usually lacks the submission controls that authenticated clients should use. Ports 465 and 587 are the common choices for authenticated submission, with TLS negotiated on the connection. Check your hosting provider's outbound port policy and your transport's documentation before you set the port in the DSN.

What changes when we upgrade the Mautic version?

The DSN itself usually survives an upgrade, but the environment around it can change. Mautic releases move on a monthly patch, quarterly minor and two-yearly major cadence, and each line has its own PHP and dependency requirements. Mautic 7.0 requires PHP 8.2 to 8.5 and a supported database, and transport plugins or Symfony Mailer components may need updates. Retest sending on staging after every upgrade, check that the transport still connects, and confirm that your release line still receives security support.

What should we ask a provider for in a written scope?

Ask for a list of the transports and sending domains in scope, the DSN format used for each, and the test cases with pass criteria. Request a description of how credentials will be stored and rotated, and which environments are covered. Confirm who performs DNS changes, who approves production sends, and how upgrade retesting is handled. Also ask what is one-time work and what is recurring support, and whether the quote covers retesting after a Mautic release. Ask for everything in writing before work starts.

Testing the transport before any campaign goes live

Test the transport end to end before any campaign is scheduled. Send test messages from the instance to internal seed mailboxes at the major consumer providers your contacts use, and check the full header set and the authentication results each provider records. Confirm that the sending domain passes SPF and DKIM and that the From domain aligns with them, because the record setup is covered in the sibling topics on SPF, DKIM and DMARC and should be finished before any volume testing begins. A transport that connects cleanly but delivers to spam folders is not ready, so review the placement of each seed message as well as whether it arrived.

Next, confirm that the queue and the scheduled jobs behave under load. Mautic queues email when the messenger consumer is in use, so send a small batch and verify that the queued messages drain completely and in order, with no stuck entries. Then run the cron-driven segment, campaign update and campaign trigger jobs in their staggered schedule and watch for a campaign that stops advancing. Check the cron logs and the database for contacts that remain in a waiting state past their expected time, since a stalled trigger often looks like a silent failure.

Finally, force a few failures on purpose and confirm they are visible. Use a mailbox that does not exist or a test address at a domain that rejects mail, then check that the bounce appears in the Mautic logs and in the contact record, and that the transport reports the rejection rather than dropping it silently. Confirm with your transport provider which bounce and complaint callbacks it sends and where they must be configured, because that behavior depends on the provider and is not defined by the DSN alone. Record the results, and repeat the sequence after any change to the DSN, credentials or sending domain.

How DeployOpen scopes and delivers Mautic mailer setup

DeployOpen treats the Mautic mailer as a production dependency, not a last-minute form field. We scope the transport DSN for your Mautic instance inside your own infrastructure, build and test it against the mail service you choose, and hand over a documented, verified configuration your operations team can run.

How we scope

  • Engagements are fixed-scope, with the transport, sending hosts and test plan agreed in writing before work starts.
  • The written scope names the mail service, the ports you will use (465, 587 or 25) and who holds the credentials.
  • We confirm which Mautic release line you run, since the DSN and mailer settings must match your installed version.
  • Scope records which environments receive the configuration, such as staging first and production afterward.

How we build

  • We write the Symfony Mailer DSN with URL-encoded credentials and verify each option against your provider's documentation.
  • Credentials go into your secret store or server environment, not into shared configuration files or tickets.
  • We test SMTP connectivity from the Mautic host, then send test messages to seed mailboxes you control.
  • We check that queued sends are processed by the messenger consumer and cron jobs your instance depends on.

How we hand over

  • You receive a written record of the DSN structure, host, port and option choices, with the reasons behind each one.
  • The handover lists the test results, including the test addresses, timestamps and any sending errors fixed during testing.
  • We document rotation steps for the mail credentials and the procedure for changing the transport later.
  • Your team receives a pre-campaign checklist covering test sends, bounce handling and a go or no-go decision.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after the fixed-scope work ends.
  • A retainer can cover re-testing the transport after Mautic upgrades, provider changes or firewall updates.
  • We can review new campaign sending volumes and adjust transport settings with your team before large sends.
  • Support requests are handled against the agreed scope, so changes to the mail provider are quoted before work starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.