System mails are not forwarded

mpeter

New Member
Apr 4, 2025
12
1
3
I have a webhook notification target that sends me a notification through ntfy, and a notification matcher that is set to match all notifications (no match rules are present) and send them to the webhook target.
If I click the test button for the notification target, I'll receive the notification almost instantly.
But I am not receiving mails sent to root, like my test emails, ZFS events, apt changelists, or anything else.

This is how I send a test mail:
echo 'test' | mail -s "This is a test" root

Why arent root mails forwarded to the webhook target I set up?

Proxmox 8.4.1, first discovered on 8.3.5
 
Try to create a “.forward” file in root's home directory (/root/.forward) with the email address that Proxmox's notification system monitors. It may work.
 
Try to create a “.forward” file in root's home directory (/root/.forward) with the email address that Proxmox's notification system monitors. It may work.
Well, that file should already exist by default. It forwards any email that was adressed to the root user to the proxmox-mail-forward binary, which then feeds the email into our notification stack.

Why arent root mails forwarded to the webhook target I set up?

Could you share your /etc/pve/notifications.cfg file? Make sure that you don't leak any sensitive data. One thing to keep in mind is that forwarded emails have a priority of 'unknown', this could be a problem if you have any Match Severity match rules.

Also, please double check if /root/.forward has the following content:

Code:
root@pve:~# cat /root/.forward
|/usr/bin/proxmox-mail-forward

Also, could you do another echo 'test' | mail -s "This is a test" root and then check the system journal for any errors logged by proxmox-mail-forward?

Did you modify postfix's configuration in any way?

Hope this helps!
 
  • Like
Reactions: Magnus-mercer
Try to create a “.forward” file in root's home directory (/root/.forward) with the email address that Proxmox's notification system monitors. It may work.

Hmm, which is that address? Afaik it should monitor root and its aliases' mailboxes.
But as Lukas said this file is there by default with a command as a forwarder.

Could you share your `/etc/pve/notifications.cfg` file? Make sure that you don't leak any sensitive data. One thing to keep in mind is that forwarded emails have a priority of 'unknown', this could be a problem if you have any Match Severity match rules.

Sure! This is how it looks:
Code:
sendmail: mail-to-root
        comment Send mails to root@pam's email address
        mailto-user root@pam

matcher: default-matcher
        comment Route all notifications to mail-to-root
        mode all
        target mail-to-root

webhook: ntfy_teszt_simple
        body e3sgbWVzc2FnZSB9fQ==
        method post
        url https://ntfy.sh/{{ secrets.kulcs }}_helyzetjelentes

matcher: everything
        mode all
        target ntfy_teszt_simple

Also, please double check if `/root/.forward` has the following content:

Yep, it has |/usr/bin/proxmox-mail-forward, a single line.

Also, could you do another `echo 'test' | mail -s "This is a test" root` and then check the system journal for any errors logged by `proxmox-mail-forward`?

Code:
jún 06 16:10:10 node804 postfix/pickup[768979]: C64632C0891: uid=1000 from=<apophis>
jún 06 16:10:10 node804 postfix/cleanup[779738]: C64632C0891: message-id=<20250606141010.C64632C0891@node804.lan>
jún 06 16:10:10 node804 postfix/qmgr[5151]: C64632C0891: from=<apophis@node804.lan>, size=410, nrcpt=1 (queue active)
jún 06 16:10:10 node804 postfix/local[779740]: C64632C0891: to=<apophis@node804.lan>, orig_to=<root>, relay=local, delay=0.02, delays=0.01/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
jún 06 16:10:10 node804 postfix/qmgr[5151]: C64632C0891: removed

It does not log anything, I only see these postfix logs. The last line before these was my SSH login.
 
Last edited:
I think there might be some alias defined in your /etc/aliases which takes effect before proxmox-mail-forward is called. From the logs we can see the that mail that was originally directed at root was delivered to the local user apophis (which seems to be the same user you use to used to send the mail with).

Please remove any lines from /etc/aliases which would redirect root's mail, such as
Code:
root: apophis
(read as: any mail to root is forwarded to apophis) or similar. After changing the file, make sure to run the newaliases command.

For reference, when everything is configured correctly, you the journal should contain a line like this after sending a mail to root:
Code:
Jun 10 10:25:34 pve postfix/local[4865]: 054809F64C: to=<root@pve.example.com>, orig_to=<root>, relay=local, delay=5.6, delays=5.5/0/0/0.01, dsn=2.0.0, status=sent (delivered to command: /usr/bin/proxmox-mail-forward)

I hope this helps!
 
  • Like
Reactions: mpeter
Oh, thanks! I indeed had `root: apophis` in that file, and after removing it and running newaliases, I received my next test mail as a Ntfy notification from my browser!

If I still want to receive root mails in my apophis account, I just need a Sendmail notification target with an apophis@pam recipient, right?
 
If I still want to receive root mails in my apophis account, I just need a Sendmail notification target with an apophis@pam recipient, right?
Yes, but if you send to apophis@pam, then the system will look up the user's email address from the user configuration and send to that address. If you want to send to the actual local user, add apophis as an 'Additional Recipient'.
 
  • Like
Reactions: mpeter