[SOLVED] use smtp to send ALL notifications

X4V1

New Member
Feb 5, 2024
15
5
3
Hello,

I added an SMTP "Notification Target" from the notification screen it works fine (tested and mail received).
I disabled the "mail-to-root" target as I wanted to use the SMTP target for all notifications.
I also updated the notification matcher to use the SMTP target instead of the "mail-to-root".

But I'm a bit surprised that I still see logs that it's not possible to send mail using port 25 (it's blocked by my ISP):
Code:
Mar 01 18:34:52 pve postfix/smtp[1808563]: DB68E24135E: to=<*************@gmail.com>, relay=none, delay=90, delays=0.02/0/90/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[142.251.9.27]:25: Connection timed out)

How can I be sure that all notifications (system wise) will be using the SMTP target?
It seems that proxmox still tries to send notifications by using postfix mail server and it's not what I want.
Example: Backup notifications (notification mode: Default (Auto)) is failing to send mail using port 25 (WHY?)

How are we supposed to configure proxmox to stop sending emails other than using the SMTP target?
I would like to never send mail using port 25 as it's never going to work.
 
Last edited:
It's solved. If someone else pass by here for the same problem, if an email is set in the backup config, it will fallback to mail-to-root. I configured postfix to allow sending mail via a smtp relay, I'll see if I receive some other notifications from mail-to-root. But at least for backup notifications, it's now solved :)

Note: the always or on-failure option is not doing anything if using the notification system as it must be configured with notification matcher.
 
Last edited:
  • Like
Reactions: alexdelprete
Hello created smtp account but mail starts with the internal smtp
After preparing that "Notification Target" in the upper half of that screen you need to adjust the lower half "Notification Matchers" to fit your needs.

Disclaimer: I do not use this. I've left the "default-matcher" active unmodified - and this means my "old" shell-level Postfix stays active...
 
  • Like
Reactions: alexdelprete
Hello created smtp account but mail starts with the internal smtp
Normally you can do everything from the gui. You are trying to send email notifications with smtp? If yes check at your backup scheduler configuration. There you don't want to have any notification options as everything will be done with notification matcher. I did everything from the gui and it works fine. If what you want is to configure postfix from the gui, that I don't think is possible.
 
I don't believe through the Proxmox GUI there is a way to force sendmail emails through the SMTP server. You would have to configure Postfix directly as before for any system emails such as smartctl automatic emails.
 
Just had this today, my backup is setup to use the Notification System, yet it's still trying to use the send mail (despite the notification system having smtp setup correctly and working with a default matcher to catch all)

They way I found out, is that the notification system is telling me that the sendmail is failing for the backup job emails, so I know that notifications are working, just despite being set it doesn't use the notification system.

1733333491361.png
 
Just had this today, my backup is setup to use the Notification System, yet it's still trying to use the send mail (despite the notification system having smtp setup correctly and working with a default matcher to catch all)

They way I found out, is that the notification system is telling me that the sendmail is failing for the backup job emails, so I know that notifications are working, just despite being set it doesn't use the notification system.

View attachment 78664
have you found a solution to use your custom smtp config and not via sendmail . postfix ?
 
have you found a solution to use your custom smtp config and not via sendmail . postfix ?
Wouldn't say it was a solution, but what it was doing was sending older notifications before I setup the SMTP server via the old send mail. I guess it was stuck in the old queue. Once it stopped retrying it works fine now.
 
Guys, I came across this topic as it seems I have exact same situation. I have a small cluster of two nodes, I have setup the smtp notification to use my local smtp server on port 25, the matche is tet pretty much default to match all. Then there is a backup job running on both nodes and I get only emails from one node. The second node never send an email, I do not see any attempt to connect on the smtp. the only thing I see is in /var/log/mail.log on the node where emails are not sent that it tries to use a postfix:

Code:
2025-03-06T08:18:23.345555+01:00 pve postfix/smtp[1415034]: connect to mail.domain.com[1.2.3.4]:25: Connection timed out

which I read that it is trying to get smtp from MX records and use that instead. it is bypassing the local smtp notifications.

the node, which works as expected does not even have any /var/log/mail.log file.

as the notifications are set per cluster, the config files on both nodes are identical. The only difference is in /etc/postfix/main.cf where the myhostname=pve.my.domain is different for each node

This looks to me like a master as I have no idea where to start investigating.
Both nodes installed within a one week, same versions /8.3.3. as of now)....

The question is: where does it decide that a postfix is used?
 
I got SMTP to work via proxmox using ssmtp. this cleared notification tests as well as just backups status and etc

Bash:
apt-get install ssmtp
vi /etc/ssmtp/ssmtp.conf

update/add your info into that conf file

Bash:
root=proxmox@accountname

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtphostname:587

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=proxmox.hostname

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES
AuthUser=proxmox
AuthPass=
#UseTLS=YES
#UseSTARTTLS=YES
 
Last edited:
  • Like
Reactions: _gabriel