Different relay hosts on Mautic + Postfix!


I have a digitalocean server, with Mautic and Postfix configured.

I use multiple domains on my emails like @domain1, @domain2, @domain3.

For each domain, I have configured postfix (sender_dependent_relayhost_maps) to use a different relayhost.

When sending manually , if sender is x@domain1 it will go to relay.domain1
If sender is a@domain2 it will go to relayhost relay.domain2

Tried to connect manually using telnet localhost 25, and it will work always.

So, I configured Mautic to use ´Other Mail Server´, ´localhost´ , ´25´.

Mautic is sending emails ok (from every campaign), but it will only use the default relayhost, even from user x@domain1 for example

Looks likes some header is different.

Can anybody help?

PS: On console, I did

sendmail -f osvaldo@domain1 -t <<EOF
To: mypersonalmail@gmail.com
Subject: Hey, testing
Content-type: text/html

Isn’t this awesome?

And it goes ok, via the correct domain1 relay.

PS2: I need this, because if I send from email@domain1 and it gets delivery by mx.domain2, the email has a higher chance of getting marked as spam.

Thank you!

1 Like

@ojaneri were you able to make that work?

Did you run postmap on the relayhosts_map file?

Please take a look at this blog post that shows details well.

Hi. I did run postmap on relayhosts_map, but no success. Tried everything I could remember, but nothing.

About the article, can you post the link? didnt appear for me. Thanks!

Oh sorry I forgot the link:

Isn’t the issue du to the fact that Mautic uses only 1 mailbox for sending the emails. So postfix does its job properly because the sender is always the same. Mautic only adds some headers for the other users, but send using always the same mailbox. (I’m not 100% sure about what I’m suggesting since I’m quite new to Mautic but it’s my current understanding of how it works)

Please let me know if you find a way to make it work

Yes, you nailed down. It uses the same inbox to send, only add +NUMBER to username so it can track bounces.

Still trying to find some workaround…Thank you

@ojaneri there’s this plugin where you can specify multiple mailboxes:

The issue is the selection is random, you lack good control. But still that might solve your issue?

Thank you for your reply, but I wont help, because I use different SMTP host based on sender. I have 4 domains on same mautic installation :frowning:

The only solution is to have 4 different mautic installation, each one with only one domain configured and the correct smtp. But I dont want to go that route, and have to admin 4 mautic´s installs instead of one (and because I use email templates and campaigns between them)

But this plugin can be modified to use the SMTP Server basead on the domain of the sender…if my programming wasnt too rusted I would try.

Just add a new field on the csv of the smtp relay configuration to be the sender domain, and change the code instead of suffle() pickup the right smtp relay for that sender.

OK I see. I was supposing something like that: that this plugin could be modified to handle this use case.

I’d like to set up Mautic this way as well, to be able to manage multiple domains, but not well versed in PHP. Quite a strong limitation that Mautic only allows 1 domain.

So, we need a way to change the headers of the Sender email to the same Sender configured on email template, instead of bounce+991919@domain.

Anyone more knowledgeable with Mautic source?

Thanks! (:

I’m interested too :
Being able to choose the SMTP server based on sender (~ owner) would be a very useful feature.
edit : Based on campaign would be even better ! @dimitri :wink:

It would be very nice to have several SMTP servers, and being able to select one on the campaign level.

yes that’s definitely needed. Currently mautic works against us for similar cases in every possible way.

  1. external-domain FROM emails are IGNORED
  2. no way to override the Mautic messing up with the FROM address (appending ‘+_XYZ’)

Yeah, Matic is not for everyone.
I suggest you try Mailwizz. Seems, that tool would work for you lot better then Mautic.
Multi SMTP server, you can even rotate them, weighted, etc. All you need to do you thing.