# Ability to specify different email gateways to use for different purposes

**URL:** <https://forum.mautic.org/t/ability-to-specify-different-email-gateways-to-use-for-different-purposes/10620>\
**Category:** Ideas and Feature Requests\
**Tags:** email-backend\
**Created:** [June 30, 2018, 11:52am UTC](https://forum.mautic.org/t/ability-to-specify-different-email-gateways-to-use-for-different-purposes/10620 "2018-06-30T11:52:24Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [October 23, 2025, 3:19pm UTC](https://forum.mautic.org/t/ability-to-specify-different-email-gateways-to-use-for-different-purposes/10620/12 "2025-10-23T15:19:44Z")

</div>

In case folks land here looking for an update, there’s a PR merged in Mautic 7 which could set the foundations for this becoming a UI feature:

> <https://github.com/mautic/mautic/pull/15422>
>
> See https://symfony.com/doc/current/mailer.html#multiple-email-transports
> 
> 
> |… Issue(s) addressed | Not sure if a separate issues need to be created
> 
> 
> \## Description
> 
> I'm developing plugin that should allow for multiple mailer transports and I would like to follow symfony's mechanism to do so.
> https://symfony.com/doc/current/mailer.html#multiple-email-transports
> 
> I can modify the configuration of the \`framework\` bundle by using a prepend in my own plugin/extension
> https://symfony.com/doc/current/bundles/prepend\_extension.html
> but I face an error from symfony that I can't define both \`transports\` and \`dsn\` for mailer. 
> My proposal is to change to the long form of defining the mailer configuration so extensions have the chance to add more transports. With the current definition it limits extensibility.
> 
> 
> 
> \---
> \### 📋 Steps to test this PR:
> Create a new plugin with the following \`DependencyInjection/MultiSMTPRoutingExtension.php\` file
> \`\`\`php
> \<?php
> 
> namespace MauticPlugin\\MultiSMTPRoutingBundle\\DependencyInjection;
> 
> use Symfony\\Component\\Config\\FileLocator;
> use Symfony\\Component\\DependencyInjection\\ContainerBuilder;
> use Symfony\\Component\\DependencyInjection\\Extension\\Extension;
> use Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface;
> use Symfony\\Component\\DependencyInjection\\Loader\\PhpFileLoader;
> 
> class MultiSMTPRoutingExtension extends Extension implements PrependExtensionInterface
> {
> /\*\*
> \* @param mixed\[\] $configs
> \*/
> public function load(array $configs, ContainerBuilder $container): void
> {
> $loader = new PhpFileLoader($container, new FileLocator(\_\_DIR\_\_.'/../Config'));
> $loader-\>load('services.php');
> }
> 
> public function prepend(ContainerBuilder $container): void
> {
> $container-\>prependExtensionConfig('framework', \[
> 'mailer' =\> \[
> 'transports' =\> \[
> 'alternative' =\> 'smtp://mailpit:1025'
> \],
> \],
> \]);
> }
> }
> \`\`\`
> With Mautic core without this PR it throws an error but with the change proposed it allows to have an additional \`alternative\` transport.

See the comment here:

> <https://github.com/mautic/mautic/pull/15422#issuecomment-3252287911>
>
> Exactly. Once the transports are defined is only a matter of identifying the typ…e of email being sent and set the mail header. For example:
> \`\`\`php
> $email-\>getHeaders()-\>addTextHeader('X-Transport', 'alternative');
> \`\`\`

---

_[View the full topic](https://forum.mautic.org/t/ability-to-specify-different-email-gateways-to-use-for-different-purposes/10620)._
