pvemailforward loses emails if mail server is not available

LaXiS

New Member
Mar 24, 2022
5
1
3
Hello,

I am using Proxmox VE 7.1-12 on my main workstation which I start and shutdown daily.
I have configured postfix to forward local email to a smarthost as explained in this tutorial and confirmed that it does work, but I noticed that I never get the email after boot.

This is the syslog during all recent boots:
Code:
May 02 18:55:18 pc-pve postfix/pickup[1442]: 9A8D14C0FC3: uid=0 from=<root>
May 02 18:55:18 pc-pve postfix/cleanup[1445]: 9A8D14C0FC3: message-id=<20220502165518.9A8D14C0FC3@pc-pve.lan>
May 02 18:55:18 pc-pve postfix/qmgr[1443]: 9A8D14C0FC3: from=<root@pc-pve.lan>, size=1001, nrcpt=1 (queue active)
[...]
May 02 18:55:18 pc-pve pvemailforward[1448]: mail forward failed: Connection refused
May 02 18:55:18 pc-pve postfix/local[1447]: 9A8D14C0FC3: to=<root@pc-pve.lan>, orig_to=<root>, relay=local, delay=0.62, delays=0.44/0.01/0/0.17, dsn=2.0.0, status=sent (delivered to command: /usr/bin/pvemailforward)
May 02 18:55:18 pc-pve postfix/qmgr[1443]: 9A8D14C0FC3: removed

This is the syslog after running echo "test" | pvemailforward via shell:
Code:
May 02 20:36:25 pc-pve pvemailforward[19296]: forward mail to <redacted@mail.com>
May 02 20:36:25 pc-pve postfix/pickup[19117]: B96F84C1002: uid=0 from=<root>
May 02 20:36:25 pc-pve postfix/cleanup[19299]: B96F84C1002: message-id=<20220502183625.B96F84C1002@pc-pve.lan>
May 02 20:36:25 pc-pve postfix/qmgr[1443]: B96F84C1002: from=<root@pc-pve.lan>, size=244, nrcpt=1 (queue active)
May 02 20:36:26 pc-pve postfix/smtp[19301]: B96F84C1002: to=<redacted@mail.com>, relay=smtp-relay.sendinblue.com[185.107.232.248]:587, delay=0.46, delays=0.01/0.01/0.31/0.14, dsn=2.0.0, status=sent (250 Message queued as <20220502183625.B96F84C1002@pc-pve.lan>)
May 02 20:36:26 pc-pve postfix/qmgr[1443]: B96F84C1002: removed

The internet connection is always available and the SMTP smarthost is indeed up, but for some reason I always get Connection refused.
But that's not the main problem: I inspected the source for pvemailforward and it's clear that the script only ever returns success, therefore postfix always considers the message as successfully sent and removes it from the queue, without the message ever actually getting sent.
Why not just return an error value and let the postfix queue handle any successive retry?

Running mail as root in a shell yields No mail for root, so those messages are effectively lost.

Thanks
 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
6,966
1,079
164
his is the syslog during all recent boots:
Code:
May 02 18:55:18 pc-pve postfix/pickup[1442]: 9A8D14C0FC3: uid=0 from=<root>
May 02 18:55:18 pc-pve postfix/cleanup[1445]: 9A8D14C0FC3: message-id=<20220502165518.9A8D14C0FC3@pc-pve.lan>
May 02 18:55:18 pc-pve postfix/qmgr[1443]: 9A8D14C0FC3: from=<root@pc-pve.lan>, size=1001, nrcpt=1 (queue active)
[...]
May 02 18:55:18 pc-pve pvemailforward[1448]: mail forward failed: Connection refused
May 02 18:55:18 pc-pve postfix/local[1447]: 9A8D14C0FC3: to=<root@pc-pve.lan>, orig_to=<root>, relay=local, delay=0.62, delays=0.44/0.01/0/0.17, dsn=2.0.0, status=sent (delivered to command: /usr/bin/pvemailforward)
May 02 18:55:18 pc-pve postfix/qmgr[1443]: 9A8D14C0FC3: removed
what's in the logs afterwards? (pvemailforward should create a new mail and send it via postfix...)
 

LaXiS

New Member
Mar 24, 2022
5
1
3
what's in the logs afterwards? (pvemailforward should create a new mail and send it via postfix...)
There aren't any additional logs coming from either postfix or pvemailforward, even after the machine has been up for some hours.
I can attach a full log but only later tonight.
 

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
6,966
1,079
164
May 02 18:55:18 pc-pve pvemailforward[1448]: mail forward failed: Connection refused
sorry - I missed this logline - this should be a good pointer already
pvemailforwards calls sendmail with appropriate options

what and where is the sendmail binary on your system?
* `which sendmail`
* `ls -la $(which sendmail)
* `dpkg -S $(which sendmail)`
 

LaXiS

New Member
Mar 24, 2022
5
1
3
sorry - I missed this logline - this should be a good pointer already
pvemailforwards calls sendmail with appropriate options

what and where is the sendmail binary on your system?
* `which sendmail`
* `ls -la $(which sendmail)
* `dpkg -S $(which sendmail)`
Thank you, the installation is a clean one from the latest 7.1 ISO, updated with no-subscription packages and with very little changes to the base OS.
Here you go:
Code:
root@pc-pve:~# which sendmail
/usr/sbin/sendmail
root@pc-pve:~# ls -la $(which sendmail)
-rwxr-xr-x 1 root root 30872 May  4  2021 /usr/sbin/sendmail
root@pc-pve:~# dpkg -S $(which sendmail)
postfix: /usr/sbin/sendmail
 
Last edited:

Stoiko Ivanov

Proxmox Staff Member
Staff member
May 2, 2018
6,966
1,079
164
hm - is postfix listening on port 25?

just in case - try running `dpkg-reconfigure postfix` and go through the dialog there
 

LaXiS

New Member
Mar 24, 2022
5
1
3
hm - is postfix listening on port 25?

just in case - try running `dpkg-reconfigure postfix` and go through the dialog there
Yes, postfix is listening as expected:
Code:
root@pc-pve:~# ss -tulnp | grep :25
tcp   LISTEN 0      100        127.0.0.1:25        0.0.0.0:*    users:(("master",pid=1444,fd=13))                                                                                                      
tcp   LISTEN 0      100            [::1]:25           [::]:*    users:(("master",pid=1444,fd=14))

I ran dpkg-reconfigure postfix and configured it like other Debian installations I already have working, will see if this fixes it.

Thank you
 
  • Like
Reactions: Stoiko Ivanov

LaXiS

New Member
Mar 24, 2022
5
1
3
Quick update: for some reason, since reconfiguring postfix I have yet to receive any automated email or even get the error logs that I was seeing earlier.
I guess we'll never know what those lost emails had to say :p
 
Last edited:

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 your own in 60 seconds.

Buy now!