Logs for e-mail notifications

skyfall

New Member
Sep 23, 2024
3
0
1
Hi,

today I was wondering why I did not receive an e-mail for a failed backup. So I went to the Notifications configuration to test the notification target with the "Test" button. It asks "Do you want to send a test notification to 'mail-to-admin'?". I click "Yes".

Then I get an error popup saying "Could not test target: could not notify via endpoint(s): mail-to-admin: Invalid input (500)".

Where are the logs for this, so I can debug what "Invalid input (500)" means? This error message is not really helpful. In the journalctl, I did not find anything.

Thanks and best regards
 
Unfortunately, the SMTP library that we use to send mails isn't super cooperative when it comes to log output, at least in its default settings. So right now there is no way to get more information. I'll try to investigate in the future and check if there is a way to make it more verbose ;)

Would you mind sharing your /etc/pve/notifications.cfg? Maybe I can help out this way.
 
Thank you for the quick reply!

Sure, here is the notifications.cfg, I am sure it worked when I first configured it (I think that was before the update to 8.2.7, not sure if something broke there maybe).

EDIT: I also tried deleting and re-creating the smtp notification target, but clicking "Test" still results in the same error.

Proxmox version: 8.2.7

Code:
smtp: mail-to-admin
    author XYZ - Host: $hostname
    from-address admin@xyz.de
    mailto-user root@pam
    mode tls
    port 465
    server smtp.strato.de
    username admin@xyz.de

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

sendmail: mail-to-root
    comment Send mails to root@pam's email address
    disable true
    mailto-user root@pam
 
Last edited:
On a hunch, try removing the '$hostname' part from 'author' and see if that changes anything. There is no variable expansion/templating for any config fields, so the mail will appear to be from 'XYZ - Host: $hostname <admin@xyz.de>' . I have not checked if there are any restrictions for the "From" email header, but that's something that you could try out super fast ;)

Hope this helps!
 
That was indeed it. But I did not make that up, I am sure I read somewhere that this is supported... Maybe it was for the backup server and I just copied that over to PVE. Thank you very much.
 
You're welcome! :)

In the UI, the default 'empty text' for the 'From Address' in Sendmail Targets reads something like "Defaults to root@$hostname." Our intent was for this to indicate that by default, mails are sent to 'root' and that Postfix automatically appends the hostname. However, I realize this could also be interpreted as supporting templating or variable expansion. While we may add that feature in the future, it would be helpful to clarify the current behavior in the UI to avoid confusion.
 

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!