Skip to content

Install Postfix

Dave Lawrence edited this page Jul 28, 2021 · 2 revisions
sudo apt-get install postfix

A prompt will appear. Select Internet and enter your fully qualified domain name (eg variantgrid.com)

Edit /etc/postfix/main.cf

Change the "myhostname" to be the full address (from the local VM hostname)

myhostname = variantgrid.com

Add the line:

virtual_alias_maps = hash:/etc/postfix/virtual

Check the following 2 lines are there:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
alias_maps = hash:/etc/aliases

The 1st stops spammers and we need alias_maps to make a no-reply address.

After modifying main.cf, be sure to run service postfix reload

Run the following (be sure to adjust for your domain) to make a no-reply address

echo "devnull: /dev/null" >> /etc/aliases
echo "[email protected] devnull" >> /etc/postfix/virtual

To then test sending

echo "This is the body" | mail -s "This is the subject" [email protected]

and check your spam folder.

Issues / Fixes

To check errors:

tail /var/log/mail.err

Missing DB:

error: open database /etc/postfix/virtual.db: No such file or directory

Can be fixed via:

postmap /etc/postfix/virtual
service postfix restart
Clone this wiki locally