Notes about Postfix mail server.
Determine postfix version
postconf -d | grep 'mail_version ='
Postfix autoresponder / autoreply
Use the ‘vacation’ program. On debian:
apt-get install vacation
As the user who will have the autoresponder:
-
cd ~
-
Create .vacation.msg:
Subject: On holiday.
Thank you for your message. I am on holiday until 01/01/2100 so I will respond to your email ASAP on my return.
-
Run the following command to initialise the vacation database and have it send an autoresponse once per day (default is a week).
vacation -i -r 1
Note that 0 should not be used otherwise it can get into an infinite loop (presumably if you send a message to yourself).
-
Create .forward, to tell postfix to forward message to autoresponder as well as delivering it:
\[username], "|/usr/bin/vacation [username]"
Testing with telnet
telnet <IP> 25
EHLO
MAIL FROM: <from-email>
RCPT TO: <recipient-email>
DATA
Type message here.
.
Reject emails to unknown recipients
To reject emails sent to unknown recipients / invalid addresses, add the following to main.cf (and reload postfix, with /etc/init.d/postfix reload
on gentoo):
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
If you’re using virtual domains then you’ll also need to remove any catch-all email addresses from /etc/postfix/virtual (and run postmap virtual
).
If it’s working then you should see NOQUEUE: reject
in the mail.log when it receives the spam mail.