Moved PMG to different host, IP change, mail server IP change also

stray

New Member
Dec 3, 2023
2
0
1
I'm using Proxmox VE, and when I was moving to a different host, from renting a dedicated server to my own server, I moved the VMs that hosted my mail server, as well as PMG.

I updated the IP addresses, and updated PMG to forward email to the new server. That went well.

Except, now when I send email, I get an automatic reply saying "Relay access denied (in reply to RCPT TO command)"

After digging a little, I discovered that in the master.cf file for postfix on PMG, the "my_networks" line did not have the IP for my mail server. It has 127.0.0.1 and PMG public IP address.

I added my mail server's IP to the list, saved the file, restarted postfix, and I can send email.

Only, it doesn't stick for very long. I don't know how long until it's reverted, but it does remove the IP of my mail server, and I can't send emails again. In the GUI, I didn't recall setting up any IP in the Networks tab under Configuration->Mail Proxy, and it was blank before I added my mail server's IP on there.

Another quirk, when I scan and email from my scanner, now it marks them as SPAM before it leaves PMG. Never did that before...

I'm tempted to just reinstall it and reconfigure it, but I'd also like to make this issue a known issue and see if there is a fix.

Edit: a funny thing I also noticed. On the dashboard, the "Top receivers" shows that a receiver not in my domain.

2nd edit: I attempted a reinstall, and the issue remains. I also discovered that it removes my mail server's IP from postfix master.cf file when the VM is restarted. That's a pain because I have backup ran of the PMG VM once a week.
 
Last edited:
I have found a workaround that has worked for me. I'm not sure if it's a bug with PMG, but the workaround was discovered in this thread:

https://forum.proxmox.com/threads/postfix-main-cf-mynetworks.40836/

To summarize, I edited the template PMG uses to change Postfix

Template location is /var/lib/pmg/templates/master.cf.in and go to line 109 which should read "-o mynetworks=127.0.0.0/8,[% postfix.int_ip %]" and add a comma with the IP of your mail server with no space. Save the file, and reboot. The IP of your mail server should be in the postfix master.cf file as well, and email will work again.
 

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!