Relay Username and password

Setgrup

Member
Oct 21, 2020
10
0
6
41
Hello,
I want to connect Proxmox Mail Gateway to an external relay service. They gave username and password, where should I add this information in the proxmox field.

Note: I want to set up all emails that will go out through Proxmox Email Gateway.
 
I haven't done this with PMG but have set up authenticated relay in postfix in the past. So not sure how/if this conflicts with any transport options you might have configured via the web UI. Also I don't believe it can be set up in the PMG web UI. If so, you need to do it via PMG's postfix templating (i.e. do not edit /etc/postfix/main.cf directly).

A basic setup (single authenticated smarthost):

cp /var/lib/pmg/templates/main.cf.in /etc/pmg/templates/main.cf.in

append to /etc/pmg/templates/main.cf.in:
Code:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth
smtp_sasl_security_options = noanonymous

/etc/postfix/smtp_auth:
Code:
relay.host.tld   username:password

chmod 640 /etc/postfix/smtp_auth
postmap /etc/postfix/smtp_auth
pmgconfig sync --restart 1

You can go further and set up sender dependent relays using:
smtp_sender_dependent_authentication
sender_dependent_relayhost_maps

See postfix SASL howto -> Configuring SASL authentication in the Postfix SMTP/LMTP client
 
Last edited:
There seems to be a lack of an actual guide on how to configure:
Internal email server > PMG > external Smarthost (> general internet) - so the Smarthost can do all of the sender verification for me but where the Smarthost has specific account credentials.
I have set up all of the inbound domains and relay (ie Internet > PMG > Internal email server) and that all works fine.
It's not clear to me how the opposite direction is configured. Is the configuration done in the Proxy page(s)?
Entering the Smarthost details in there seems to be at odds with the incoming mail configuration?
Can this internalserver > PMG > Smarthost config actually be completed in the UI, or do I have to fall back to the config files themselves?
A nice short how-to would be appreciated for a first-timer.
 
Last edited:
If you are not delivering outging mail directly but instead using a smarthost, you can configure that directly in the PMG web UI
If that smarthost requires authentication, then AFAIK, you must add the auth config directly in postfix config /etc/pmg/templates/main.cf.in and a supplementary lookup file.
If you have more than one smarthost (e.g. sender dependent relayhost) you can configure multiple relay hosts. Similar to above with additon of a relay host lookup and additonal host username:pasword lookups.
The postfix SASL howto above outlines it fairly well and the steps I mentioned above should work.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!