Config postfix smarthost¶
smarthost with any smtp-server¶
have a look at: https://www.alldiscoveries.com/configuring-relayhost-smarthost-ubuntu-server-22-04-lts-with-gmail-or-another-email-server-via-postfix/
smarthost with local mailcow-dockerized¶
currently we are using Ubuntu only as a base for mailcow.
So things are a bit different here, see also: https://docs.mailcow.email/post_installation/firststeps-local_mta/
install postfix and mail¶
sudo apt install mailutils
configure postfix¶
sudo vim /etc/postfix/master.cf
#smtp inet n - - - - smtpd
sudo vim /etc/postfix/main.cf
# as per https://docs.mailcow.email/post_installation/firststeps-local_mta/ relayhost = 172.22.1.1 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 inet_interfaces = loopback-only relay_transport = relay default_transport = smtp
additionally we need to know the server and email-address as well as the password to use
vim /etc/postfix/sasl_passwd
mail.example.com:587 mailadr@example.com:password
The above server hostname and port must exactly match the value for "relayhost" in /etc/postfix/main.cf.
Generate a postfix lookup table from the previous file
postmap hash:/etc/postfix/sasl_passwd
Test the lookup table, if all is good then the following will return the specified username:password
postmap -q mail.example.com:587 /etc/postfix/sasl_passwd
next is to bind the local username to the email-address. You may also have a look into /etc/aliases
and check who's mail are sent to whom.
vim /etc/postfix/canonical
root mailadr@example.com
The above email-address must exactly match the email-address in sasl_passwd.
Generate a postfix lookup table from the previous file
postmap hash:/etc/postfix/canonical
Make sure that sasl_passwd and sasl_passwd.db files are readable/writeable only by root
chmod 600 /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd.db
Add postfix to be started at boot
systemctl enable postfix
maybe necessary¶
sudo mkfifo /var/spool/postfix/public/pickup
Von Jeremias Keihsler vor 9 Monaten aktualisiert · 3 Revisionen