Our current setup is a webserver at www.domain.tld
(DNS A record) and a mail server (postfix) at mail.domain.tld
(DNS MX record) on one dedicated server (IP address 1.2.3.4
).
Our website sends out newsletters every day to our subscribers so the current machine has to handle both, the webserver and mail server load.
We would like to "outsource" the newsletter delivery to a second dedicated mail server with IP address 4.3.2.1
at mail2.domain.tld
.
So in addition to the current MX record mail
to 1.2.3.4
, we are planning to add a second MX record mail2
to 4.3.2.1
with lower priority.
Now we would like to continue to use our current mail server mail
as before for our regular mail accounts (postfix, courier, DKIM, DMARC, SPF, virtual users is already set up). Further, our newsletter application hosted on the webserver at 1.2.3.4
should be using the new mail server at mail2
to send out newsletters, and relaying mails to @domain.tld
sent to mail2
to mail
. (It could be that some mails get sent to mail2
.)
To my understanding, mail2.example.com
should ONLY be allowed to send out mails when they come from 1.2.3.4
, AND it should relay incoming mails to mail
ONLY when they go to @domain.tld
.
mail
should continue to work for our "regular" mail accounts.
Thus, the "hard work" of sending out several thousand mails per day would be offloaded to the machine at 4.3.2.1
separating web and "newsletter" traffic.
How can I achieve this? We use Debian Jessie and postfix on both machines. I understand I can relay the incoming mail as similarly described here: Postfix : Relaying all incoming mail to another host
How do I get the "send newsletter" part?
If you need more specific information please let me know!
This is just a mail routing question if I understand correctly, the domain mail exchange records and their priority won't really help here - since the news letter is routing mail from a dedicated host simply configure it's mail server to be mail2 - there is no need to make an MX record for it unless it's going to be the backup mail exchange for your domain, but I would:
1 - setup the newsletter server up to use the dedicated mail relay (with no mailboxes - just realy)
2 - set mail1.domain.tld as mx5.domain.tld
3 - set mail2.domain.tld as mx10.domain.tld
this way the heavy lifting is being done by mail2 and you have a backup mail relay
So configuring postfix as a gateway/firewall as described at http://www.postfix.org/STANDARD_CONFIGURATION_README.html#firewall did the trick. I can send mail directly through
mail2
, and incoming mail atmail2
is relayed tomail
.MX records are needed as mail servers very often check if it exists for spam policy reasons.