Does anyone know if it is possible to setup postfix with a destination for a domain. If that destination (which is also running postfix) can't accept the mail because it's disk is full or it is offline. Then another destination will be tried.

Kinda like MX Records, which will work if a server is offline by moving onto the next record but not if it can't accept the mail due to a disk space being full. Or am I wrong with that?

1 Answer 1


If destination mail server has empty free-space, then the email can't accept an email. Mail server have to store the email temporarily to queuing it before sending it to next destination.

Proper mail server will throw 4xx when it's happened. It means, "I can't accept your mail right now. You may try again later" (RFC 2821 point 4.2.1). When getting 4xx-code from the server, mail client will has several options

  • Retry next server based on result of MX lookup
  • Wait and retry the primary mail server

Unfortunately RFC doesn't recommend specific behavior when this happened. Mail client may choose first option or second one.

I've try to simulate this condition to gather some data about how several big Mail Provider response to 4xx reply code

  • My server with Postfix 2.10 will immediately tries to send email to the secondary mail server
  • GMail will keep trying to primary mail server after several minutes later
  • Yahoo will keep trying to primary mail server after several minutes later

How to workaround to this problem?

One option was adding some script that regularly check free space of the server. If disk usage was higher than certain threshold then you can shield port 25 with firewall from the internet. Both yahoo and gmail will immediately try to send to next server-preferred when a mail server is unreachable or doesn't respond at all.

Related: SMTP 4xx and secondary MX record as a way to redirect mail

  • are you sure they wouldn't just try the same server again at a later time as it is responding ( as it has a higher priority then the other mail servers so should take priority over them to deliver the mail to this server ). Appose to no response and trying the next priority mail server?
    – PixelPaul
    Feb 22, 2015 at 7:45
  • Hi, thanks for the correction. Looks like RFC doesn't have specific recommendation regarding this event. See my edit above.
    – masegaloeh
    Feb 22, 2015 at 10:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .