I've got a (possibly unusual) situation with using Postfix to relay mail to another Postfix mail server that then needs to send the email out. I've read plenty of tutorials and seen instructions for using Postfix as an email relay to send to an external provider like Google, etc. This is different though, in that I need to send to another Postfix server and have it act as the sender. The sender would always be the same (for both servers), but the end recipients could be anyone.
The problem is that I'm missing some critical information:
- How do I tell mail.postfix2.com to accept relayed mail from postfix1.com?
- How do I tell mail.postfix2.com to send the relayed mail on to the destination?
- How do I change the port in which mail.postfix2.com accepts the relayed mail on?
Here are the basic configuration parameters:
Postfix Server 1:
main.cf: myhostname = postfix1.com relayhost = mail.postfix2.com mydestination = postfix1.com, localhost.postfix1.com, localhost, mail.postfix2.com inet_interfaces = all
Postfix Server 2:
main.cf: myhostname = mail.postfix2.com mydomain = postfix2.com mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain relay_domains = $mydestination inet_interfaces = all
When I try relaying to mail.postfix2.com I get:
Oct 21 11:04:28 ns3312015 postfix/error: C016F47E75B5: to=
<firstname.lastname@example.org>, relay=none, delay=25, delays=1.4/24/0/0.1, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to mail.postfix2.com[126.96.36.199]:25: Connection timed out)
Although I've got port 25 open I suspect the host is somehow blocking it, so I tried instead to use this parameter in my postfix1.com main.cf:
relayhost = mail.postfix2.com:587
and on postfix2.com I un-commented this in master.cf:
submission inet n - n - - smtpd
The response back was:
Oct 21 09:56:03 ns3312015 postfix/smtp: B8BB347E71F0: to=
<email@example.com>, relay=mail.postfix2.com[188.8.131.52]:587, delay=1.4, delays=0.68/0.02/0.25/0.5, dsn=4.7.1, status=deferred (host mail.postfix2.com[184.108.40.206] said: 454 4.7.1
<firstname.lastname@example.org>: Relay access denied (in reply to RCPT TO command))
What do I need to do for mail.postfix2.com to accept the postfix1.com mail and send it on?