Score:0

Postfix: how to accept then bounce emails for some domains (example: gmail.fr)

ph flag

All this is specific to domains with no incoming emails at all and with no available MX.

A domain may not have any MX record, that's RFC-compliant, but may have a A record that doesn't point to any email server. In this situation, postfix tries to deliver an email to this domain using the @IP from A record. As the server at @IP is not a SMTP server delivery always fails (after a long time and a lot of retries). The consequence of this situation is that postfix sends regular warning emails to the sender (temporarily failure) and a hard bounce message (undeliverable) after several days. A good example of this is a domain such as gmail.fr. Of course, Gmail never created any email box @gmail.fr, however some eyeballs make a mistake and write emails to [email protected] instead of [email protected]. gmail.fr has no MX record but a valid A record for web redirections (no smtp server here).

What I try to achieve is to make postfix accept any email for *@gmail.fr and then send an undeliverable email back to sender at once. The incoming email should not be rejected because my postfix server is a relaying server. It has to accept the incoming email and deal with it "later".

Edit: As suggested, an explanation on accepting emails on the relaying Postfix.

Imagine an application that create an email. This application has to drop this email on internal/intranet postfix that only take care of it by relaying it to the main postfix connected to the internet.

The application creating the email does not have any idea about email recipient validity and it does not care about it.

The internal postfix is only there to forward the email. It has no internet connectivity and all it knows is a smarthost.

The relaying external postfix gets the email and if something is wrong should bounce it to the sender (should not refuse incoming email).

djdomi avatar
za flag
I think you looking for a rewrite
anx avatar
fr flag
anx
You can make any theoretically deliverable mail (more precisely: recipient) undeliverable my giving postfix an `error:` in `transport_map` - or a `REJECT` in a `check_recipient_access` map. Best to chose a very explicit message to ensure quick remediation when the *République* finally forces Google to use a proper, French name ;)
anx avatar
fr flag
anx
Please [clarify](https://serverfault.com/posts/1101601/edit) your last suggestion. Why would you want to accept legitimate (albeit misdirected) mail that you already have chosen not to deliver? Delaying the feedback does not improve things (opposite; subject to further errors, possibly giving no feedback at all).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.