Add smtp2go authenticated relay to Proxmox Mail Gateway 9

A bad neighbor on my VPS got my entire subnet blacklisted, so I decided to look into using an SMTP relay to deliver my mail. I decided to use smtp2go. Configuration for Proxmox 9 is different than previous versions, so I had to do a bit of research before I could get authenticated SMTP relay to work properly.

Instead of editing postfix conf directly, you copy the configuration template from /var/lib/pmg/templates to /etc/pmg/templates (create the directory first if it doesn’t exist.) and modify the template file instead. NOTE you must ensure the whole template is there. If you simply paste a configuration snippet into a template file and not the entire thing, all those other configuration lines will not get put into the resulting postfix.conf. Once the template is there, run pmgconfig sync --restart 1 to get PMG to read the template and copy settings out accordingly.

So the full procedure is:

  • Create directory and copy template file over
    mkdir /etc/pmg/templates
    cp /var/lib/pmg/templates/main.cf.in /etc/pmg/templates
  • Modify freshly copied /etc/pmg/templates/main.cf.in template to add authenticated relay (append to the bottom)
relayhost = [mail.smtp2go.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth
  • Create smtp_auth file:
    [mail.smtp2go.com]:587 USERNAME:PASSWORD
  • Set permissions & postmap file:
    chown 600 /etc/postfix/smtp_auth
    postmap /etc/postfix/smtp_auth
  • Sync template settings and restart postfix:
    pmgconfig sync --restart 1

Profit

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.