Gyari

New Member
Nov 28, 2020
23
1
3
Hello!

I'd like to configure postfiy to send emails from proxmox and i'm looking for some help. I'd like to use posteo as smtp server if it is possible...

Here is what i did to make it work:

1. Installed libsasl2-modules

apt-get install libsasl2-modules

2. Specified account details:

nano /etc/postfix/sasl_passwd
[posteo.de]:587 my_username@posteo.de:mypassword

3. Created hash:

postmap hash:/etc/postfix/sasl_passwd

4. Linmited the access of the file contains my account details:

chmod 600 /etc/postfix/sasl_passwd

5. Configured postfix configuration file

nano /etc/postfix/main.cf
- changed relay host:
relayhost = [posteo.de]:587

- added these lines to the end of the config file:
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

6. Reloading postfix service

postfix reload

7. Test if mail is sent:

echo "test mail from proxmox" | mail -s test my_alias@posteo.de

Unfotunately the mail hasn't arrived, this is what the logs says:

Code:
tail -f /var/log/syslog
Apr 21 16:06:46 pve postfix/qmgr[52904]: 8380718132: removed
Apr 21 16:06:46 pve pvemailforward[53005]: forward mail to <my_username@posteo.de>
Apr 21 16:06:46 pve postfix/pickup[52903]: 57ECE185B9: uid=65534 from=<root>
Apr 21 16:06:46 pve postfix/cleanup[52999]: 57ECE185B9: message-id=<20210421140646.24DC9185B8@pve.local.lan>
Apr 21 16:06:46 pve postfix/qmgr[52904]: 57ECE185B9: from=<root@pve.local.lan>, size=2614, nrcpt=1 (queue active)
Apr 21 16:06:46 pve postfix/local[53004]: 24DC9185B8: to=<root@pve.local.lan>, relay=local, delay=0.21, delays=0/0.01/0/0.21, dsn=2.0.0, status=sent (delivered to command: /usr/bin/pvemailforward)
Apr 21 16:06:46 pve postfix/qmgr[52904]: 24DC9185B8: removed
Apr 21 16:06:46 pve postfix/smtp[53001]: 57ECE185B9: to=<my_username@posteo.de>, relay=posteo.de[185.67.36.145]:587, delay=0.41, delays=0/0/0.36/0.05, dsn=5.1.8, status=bounced (host posteo.de[185.67.36.145] said: 554 5.1.8 <root@pve.local.lan>: Sender address rejected: Domain not found (in reply to RCPT TO command))
Apr 21 16:06:46 pve postfix/cleanup[52999]: C6073185BA: message-id=<20210421140646.C6073185BA@pve.local.lan>
Apr 21 16:06:46 pve postfix/qmgr[52904]: 57ECE185B9: removed
Apr 21 16:07:00 pve systemd[1]: Starting Proxmox VE replication runner...
Apr 21 16:07:00 pve systemd[1]: pvesr.service: Succeeded.
Apr 21 16:07:00 pve systemd[1]: Started Proxmox VE replication runner

Am i correct that the sender wants to be root@pve.local.lan? If yes, where could i change it? When i installed proxmox i gave an email address (posteo), and if i checked in the GUI under users the root user has the address i gave it at install.

Does anyone have maybe some suggestion?

And is there any way to use SSL instead starttls?

Thanks any help!
 
Last edited:

Gyari

New Member
Nov 28, 2020
23
1
3
Thanks! Now the email arrives, but there is some strange things i don't understand:
This is how a mail looks like when i receive it:

From: Mail Delivery System <MAILER-DAEMON@pve.local.lan> Subject: Undelivered Mail Returned to Sender To: root@pve.local.lan This is the mail system at host pve.local.lan. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system <myalias@posteo.de>: host posteo.de[185.67.36.145] said: 554 5.1.8 <root@pve.local.lan>: Sender address rejected: Domain not found (in reply to RCPT TO command) ------------------------------------------------------------------------------------------ Reporting-MTA: dns; pve.local.lan X-Postfix-Queue-ID: xxxxxxxxxx X-Postfix-Sender: rfc822; root@pve.local.lan Arrival-Date: Thu, 22 Apr 2021 14:40:15 +0200 (CEST) Final-Recipient: rfc822; myalias@posteo.de Original-Recipient: rfc822;myalias@posteo.de Action: failed Status: 5.1.8 Remote-MTA: dns; posteo.de Diagnostic-Code: smtp; 554 5.1.8 <root@pve.local.lan>: Sender address rejected: Domain not found -------------test.eml----------------------------------------------------------------------- Subject: test From: root <root@pve.local.lan> Date: 2021. 04. 22. 14:40 To: myalias@posteo.de test mail from proxmox

Somehow root@pve.local.lan is still there but now at least as recepient and not sender, there is a line where From: root <root@pve.local.lan>, but that is the one which arrived. Or at least i hope i undestand it correctly that this is the case.

Therse are the logs after this command:
Code:
echo "test mail from proxmox" | mail -s test my_alias@posteo.de command:

tail -f /var/log/syslog Apr 22 14:40:20 pve postfix/qmgr[2120]: 0972918185: removed Apr 22 14:40:20 pve pvemailforward[12803]: forward mail to <myusername@posteo.de> Apr 22 14:40:20 pve postfix/pickup[2119]: 68FCD18801: uid=65534 from=<myusername@posteo.de> Apr 22 14:40:20 pve postfix/cleanup[12701]: 68FCD18801: message-id=<20210422124020.3585518800@pve.local.lan> Apr 22 14:40:20 pve postfix/qmgr[2120]: 68FCD18801: from=<myusername@posteo.de>, size=2614, nrcpt=1 (queue active) Apr 22 14:40:20 pve postfix/smtp[12703]: connect to posteo.de[2a05:bc0:1000::145:1]:587: Network is unreachable Apr 22 14:40:20 pve postfix/local[12802]: 3585518800: to=<root@pve.local.lan>, relay=local, delay=0.22, delays=0/0.01/0/0.21, dsn=2.0.0, status=sent (delivered to command: /usr/bin/pvemailforward) Apr 22 14:40:20 pve postfix/qmgr[2120]: 3585518800: removed Apr 22 14:40:21 pve postfix/smtp[12703]: 68FCD18801: to=<myusername@posteo.de>, relay=posteo.de[185.67.36.145]:587, delay=0.77, delays=0/0/0.53/0.24, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 4FQxpY02ZTz9rxW) Apr 22 14:40:21 pve postfix/qmgr[2120]: 68FCD18801: removed

I think besides the fact that root@pvee.local.lan is still there as a recepient i don't really see anything in the logs.
 
Last edited:

janssensm

Well-Known Member
Dec 18, 2016
221
67
48
What happens when you add a from address in the test? Something like:

Code:
echo "test mail from proxmox" | mail -r my_alias@posteo.de -s test my_alias@posteo.de

Also keep in mind, the mail provider can be picky what sender addresses are allowed to send from a single account.
 
  • Like
Reactions: Gyari

Gyari

New Member
Nov 28, 2020
23
1
3
What happens when you add a from address in the test? Something like:

Code:
echo "test mail from proxmox" | mail -r my_alias@posteo.de -s test my_alias@posteo.de

Also keep in mind, the mail provider can be picky what sender addresses are allowed to send from a single account.
Thanks!

Now it works perfectly fine! And how should i make it to be the default settings? Is there any config file where i can edit this? I tried to dig into postfix a bit, but everywhere i just read that /etc/postfix/main.cf is the one to edit, but i didn't find any useful option.
 

janssensm

Well-Known Member
Dec 18, 2016
221
67
48
Thanks!

Now it works perfectly fine! And how should i make it to be the default settings? Is there any config file where i can edit this? I tried to dig into postfix a bit, but everywhere i just read that /etc/postfix/main.cf is the one to edit, but i didn't find any useful option.
Nice, I think that for the pve mails f.e. for updates (in case of subscription) or backups, the setting in datacenter should be sufficient.
You could try and run a backup with mail notify and see if that works.
 
Last edited:
  • Like
Reactions: Gyari

lxiosjao

Member
Mar 21, 2021
37
0
6
Hi,
I have the same issue.

Code:
<root@pve.local.lan>: Sender address rejected: Domain not found (in reply to RCPT TO command))

I can send email when I add a "from" like that :
Code:
echo "test mail from proxmox" | mail -r my_alias@posteo.de -s test my_alias@posteo.de

I add my email in the permissions > users > root (used for the "from" right ?)

Mail notify doesn't work when I run the backup job.
Any idea ?
 
Last edited:

janssensm

Well-Known Member
Dec 18, 2016
221
67
48
I add my email in the permissions > users > root (used for the "from" right ?)
Hi, this field is for "to" address, as noted in the official admin doc 14.1.1:
System mails will be sent to the email address assigned to this user.
The field you want to configure is what I mentioned earlier in this thread via gui: https://forum.proxmox.com/threads/postfix-configuration.87993/post-385771
Or as described in the official admin doc 23.1.2, you can also set it directly in /etc/pve/datacenter.cfg
 
  • Like
Reactions: lxiosjao

lxiosjao

Member
Mar 21, 2021
37
0
6
Hi, this field is for "to" address, as noted in the official admin doc 14.1.1:

The field you want to configure is what I mentioned earlier in this thread via gui: https://forum.proxmox.com/threads/postfix-configuration.87993/post-385771
Or as described in the official admin doc 23.1.2, you can also set it directly in /etc/pve/datacenter.cfg
It works for backups, thanks. But it seems to fail with zfs-zed.
I think the mail added in /etc/pve/datacenter.cfg is not used by zfs-zed. Any idea ?
 
Last edited:

Dunuin

Famous Member
Jun 30, 2020
6,769
1,575
149
Germany
Did you edit the "/etc/zfs/zed.d/zed.rc"?
Since last week this was like this:
Code:
##
# Email address of the zpool administrator for receipt of notifications;
#   multiple addresses can be specified if they are delimited by whitespace.
# Email will only be sent if ZED_EMAIL_ADDR is defined.
# Disabled by default; uncomment to enable.
#
#ZED_EMAIL_ADDR="root@localhost"
The zed update last week changed this and "ZED_EMAIL_ADDR="root@localhost"" is now enabled by default. So you might want to put your email address there instead of "root@localhast".

And I also edited other lines like this one:
Code:
##
# Command-line options for ZED_EMAIL_PROG.
# The string @ADDRESS@ will be replaced with the recipient email address(es).
# The string @SUBJECT@ will be replaced with the notification subject;
#   this should be protected with quotes to prevent word-splitting.
# Email will only be sent if ZED_EMAIL_ADDR is defined.
#
ZED_EMAIL_OPTS="-s '@SUBJECT@' -a 'From:\<myaddress@allowedbysmtp.hoster\>' @ADDRESS@"
Because atleast here the SMTP server provider won't allow emails to be relayed when the "from address" isn't matching my email account at that hoster.
 
Last edited:

janssensm

Well-Known Member
Dec 18, 2016
221
67
48
The zed update last week changed this and "ZED_EMAIL_ADDR="root@localhost"" is now enabled by default.
Ah,did not spot this change, it appears to have landed in pve-no-subscription repository (ZFS 2.1.4), but not yet in pve-enterprise (ZFS 2.1.2).
The change comes with ZFS 2.1.3:
https://git.proxmox.com/?p=zfsonlin...2;hb=ca1ed9a9bf26dcfaf74a7166ca4defe830377d78

Update for the documentation is coming:
https://git.proxmox.com/?p=pve-docs.git;a=commit;h=aa425868069818167ff0a3cca5c64a2acc88173e
 

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!