Postfix notes

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:

  1. cd ~

  2. 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.

  3. 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).

  4. 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.

References

Last modified: 08/06/2015 Tags: ,

Related Pages

Other pages possibly of interest:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top