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?
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
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
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