DevHeads.net

How to autoreply with "Undelivered Mail Returned to Sender" unknown user for user+doesnotexist@domain.org

Hello,

Let's say that I do have a user "user" on my system, but I would like
for emails sent to "user+ ... at domain dot org" to bounce back the
"Undelivered mail" message with something like:

<user+ ... at domain dot org>: unknown user: "user+doesnotexist"

How would I do this? I naively tried adding

user+doesnotexist: doesnoteixst

to my /etc/aliases file, but it was still delivered to my user account.

Thanks for any help.

Cheers,
Thomas

Comments

Re: How to autoreply with "Undelivered Mail Returned to Sender"

By Wietse Venema at 07/11/2018 - 11:03

Thomas Nyberg:
/etc/aliases is used only for mail handled by the local(8)
delivery agent.

Alternative: use a transport map; that works for all domains.

/etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport:
user+ ... at example dot com error:5.1.1 User does not receive mail.

Requires "postmap hash:/etc/postfix/transport".

Wietse

Re: How to autoreply with "Undelivered Mail Returned to Sender"

By Thomas Nyberg at 07/11/2018 - 15:30

On 07/11/2018 08:03 AM, Wietse Venema wrote:
Thank you very much this worked perfectly!

Cheers,
Thomas

Re: How to autoreply with "Undelivered Mail Returned to Sender"

By Bill Cole at 07/11/2018 - 10:55

Start by consulting the instructions sent to every new subscriber to
this list, specifically to read and follow these suggestions:

<a href="http://www.postfix.org/DEBUG_README.html#mail" title="http://www.postfix.org/DEBUG_README.html#mail">http://www.postfix.org/DEBUG_README.html#mail</a>

How to make *YOUR* system reject a particular address that it is now
delivering depends on what it is about *YOUR* configuration that is
causing that delivery to happen in the first place.