Proxmox and Postfix SMTP Relay
This tutorial is going to show you how to set up Postfix SMTP relay on Proxmox VE 7.1 using Sendinblue (requires signing up for a free account). I have not tested this on earlier builds of Proxmox.
Install Postfix libsasl2-modules
1
apt install postfix libsasl2-modules
Once that’s complete, you will need to edit the main configuration file for Postfix.
1
nano /etc/postfix/main.cf
Add the following lines:
1
2
3
4
relayhost = [smtp-relay.sendinblue.com]:587
# outbound relay configurations
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
Then create the /etc/postfix/sasl_passwd file.
1
nano /etc/postfix/sasl_passwd
Add the following in the file:
1
[smtp-relay.sendinblue.com]:587 smtp_username:smtp_password
The SMTP_Username is the email address you used to sign up for Sendinblue. To get the password, you need to log in to Sendinblue and access SMTP & API settings under your user profile (Click on you username at the top right of the main Sendinblue page).
Then create the corresponding hash db file with postmap.
1
postmap /etc/postfix/sasl_passwd
Now you should have a file /etc/postfix/sasl_passwd.db. Restart Postfix for the changes to take effect.
1
systemctl restart postfix
By default, sasl_passwd and sasl_passwd.db file can be read by any user on the server. Change the permission to 600 so only root can read and write to these two files.
1
chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
Now we can send a test email with a command like below.
1
echo "this is a test email." | mailx -r from-address -s hello to-address
Please Note: Email may end up in your junk mail folder.