1

I'm trying to configure my postfix (2.9.6) mail server to initially try deliver messages directly to the recipient MX, then fall back to relaying through my ISP's mail server if it recieves a 5xx status code. My mail server is on the end of a home broadband connection so it falls foul of spamhaus filtering. I'm aware that I could relay everything through my ISP's server, but I'd rather not unless it is absolutely necessary. Call me paranoid.

I was hoping that something like this in main.cf would do the job (port 11125 is an stunnel to my ISP's mail relay, and does work if I set it as the relayhost)

relayhost =
smtp_skip_5xx_greeting = yes
smtp_fallback_relay = [127.0.0.1]:11125

That just bounces though, eg

Nov 19 12:46:15 mail-server postfix/smtp[14459]: E9275744: to=<test@hotmail.co.uk>, relay=mx2.hotmail.com[65.55.92.136]:25, delay=1.3, delays=0.04/0.01/0.46/0.81, dsn=5.0.0, status=bounced (host mx2.hotmail.com[65.55.92.136] said: 550 OU-002 (SNT0-MC1-F51) Unfortunately, messages from xx.xx.xx.xx weren't sent. Please contact your Internet service provider since part of their network is on our block list. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors. (in reply to end of DATA command))

So, is it possible to have postfix attempt to deliver via a fallback relay in the face of such a message?

paulos
  • 1,694
  • 10
  • 12
  • 2
    even if that was possible (which I don't think, but I'm not sure) i wouldn't recommend it. Re-sending every hard-bounced mail doesn't make any sense. *Many* (I'd say most) professional MTAs will not accept mail from a home ip range, so most of your mail would be sent through your ISP's MTA anyway. You'd probably be better off setting up a trusted mail relay on a non-residential IP – Gryphius Nov 19 '13 at 15:18
  • 2
    This is not really off-topic and is actually a thing out in the wild. It's a problem for businesses warming up new server IPs. Initially, your server's IP will likely have deliverability problems so, while it's reputation is building, you still need to get mail delivered. But if you don't send from your new IP it'll never build it's reputation. I have basically the same question over here: http://serverfault.com/questions/838289/relay-email-through-another-server-on-smtp-error-in-postfix/838304#838304 – Shovas Mar 16 '17 at 15:23

1 Answers1

1

There's no such option in the config. You might possibly do something creative with piping bounces through a script that adds the target domain to a transport table and re-sends the email. But I'd advise you to either get a server from a colo provider who isn't spam-infested enough to get added to blacklists, or to simply use your ISP:s server.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • There may now be a method of doing this by using the soft_bounce=yes conf param. We're working on that over here since it is a legitimate concern for warming up new server IPs since their sender reputation can be low or even negative when you get a hold of a new server: http://serverfault.com/questions/838289/relay-postfix-email-through-another-server-for-bounces/838304?noredirect=1#comment1072848_838304 – Shovas Mar 22 '17 at 14:17