Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to reject mails to a certain address with a custom message. Mails to other non existing addresses should be unchanged. How can I do that? I'm using Postfix 2.7.0 on Ubuntu 10.4.

Background: My websites sends mails to my users, and so far, my personal address is used as the sender. I would like to change this to a noreply@... address, but since the users reply quite often to these emails, I would like to send them a helpful reject message.


share|improve this question
So, basically you want to reply with a helpful reject message on messages sent to a noreply address :) – ΤΖΩΤΖΙΟΥ May 8 '11 at 15:54
up vote 13 down vote accepted

Create a custom_replies map (i.e. /etc/postfix/custom_replies) with the following contents: REJECT Like I said, NOREPLY

Run sudo postmap /etc/postfix/custom_replies.

Edit /etc/postfix/ and put the following as the first check of the smtpd_recipient_restrictions:

check_recipient_access hash:/etc/postfix/custom_replies,

Then issue a sudo postfix reload.

Try sending email to

$ telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 ESMTP Postfix (Ubuntu)
HELO localhost
250 2.1.0 Ok
554 5.7.1 <>: Recipient address rejected: Like I said, NOREPLY
221 2.0.0 Bye
share|improve this answer
Obviously I ran the telnet session on the mail server itself. – ΤΖΩΤΖΙΟΥ May 8 '11 at 16:37
Works great. Thank you!!! – Richard West Feb 17 '13 at 14:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.