LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Postfix: customized reject message per virtual domain (or user)? (http://www.linuxquestions.org/questions/linux-server-73/postfix-customized-reject-message-per-virtual-domain-or-user-823106/)

exscape 07-30-2010 03:16 PM

Postfix: customized reject message per virtual domain (or user)?
 
Here's the deal. I have a mail server taking care of mail for my 4 domains; the first is used for virtually all mail, the second rarely used anymore, the third is virtually 100% spam the past year(?), and the fourth isn't in use (and never has been, so no spam).

What I'd like to do is to reject all mail to the third domain, but give humans a hint on how to contact me. Right now this is what I get (I tried to send to a nonexistent address from gmail):
Code:

Delivery to the following recipient failed permanently:

    bouncetest@domain.net

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider
for further information about the cause of this error.
The error that the other server returned was: 550 550 5.1.1 <bouncetest@domain.net>: Recipient address rejected: User unknown in virtual mailbox table (state 14).

----- Original message -----

[...]

Since my username (xyz@) is the same for all domains, I could (or so I hope) change the reject message to give a hint to replace @olddomain.net with @realdomain.net and try again. I doubt any bots are going to catch on to that, but someone trying to reach me on an old address might.

Uh, long story short: see topic line.
Is this possible (in an easy enough way, too ;))?

Thanks in advance.

Berhanie 07-30-2010 06:21 PM

The relocated database might be useful here. Also see here.

exscape 07-31-2010 02:53 AM

Ah, yes, that worked. Thanks :)

Mini-tutorial:
1) Read the man page and create the file (in my case, /etc/postfix/relocated, contents "@domain.net SAME_USERNAME_HERE@realdomain.net"
2) postmap /etc/postfix/relocated
3) Edit main.cf to include:
Code:

relocated_maps = hash:/etc/postfix/relocated
4) Delete the user(s) from the virtual table, since any user in there will get mail regardless (I left abuse@, noc@, postmaster@ et. al. and they still work).

Not quite as pretty as a custom message, but it should work well enough, in case someone actually reads it:

Code:

Delivery to the following recipient failed permanently:

    myalias@domain.net

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient domain.
We recommend contacting the other email provider for further information about the cause of this error.
The error that the other server returned was: 550 550 5.1.6 <myalias@domain.net>: Recipient address rejected: User has moved to SAME_USERNAME_HERE@realdomain.net (state 14).

----- Original message -----
...



All times are GMT -5. The time now is 06:09 AM.