如何从 XEN DOM0 内部通过 msmtp 发送电子邮件

如何从 XEN DOM0 内部通过 msmtp 发送电子邮件

我有一个带有一些虚拟机的 XEN 服务器,其中之一是电子邮件服务器。

如何告诉 DOM0 将所有根电子邮件发送到我的管理电子邮件(位于电子邮件虚拟机内)?

我尝试安装msmtpd并添加配置文件/etc/msmtprc

# A system wide configuration file is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account default

# The SMTP smarthost
host mail.myOtherVM.de

# Use TLS on port 465
port 587
tls on
tls_starttls on

# Construct envelope-from addresses of the form "[email protected]"
from %[email protected]

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
syslog LOG_MAIL

但是当尝试发送电子邮件时

echo -e "Subject: msmtp test\nhello test." | msmtp [email protected]

在我的电子邮件虚拟机上,我收到错误:

lost connection after DATA from unknown[2a01:xxxx:1d02::2]
disconnect from unknown[2a01:xxxx:1d02::2] ehlo=2 starttls=1 mail=1 rcpt=0/1 data=0/1 commands=4/6

(我也尝试过 465 端口,但该端口根本没有打开。)

答案1

msmtp仅适用于用户名和密码,例如/etc/msmtprc

defaults

# Use TLS on port 465
port 587
tls on
tls_starttls on

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER
syslog LOG_MAIL

# Mail account
account [email protected]
 
from yourserver dom0 <[email protected]>

# Host name of the SMTP server
host mail.yourserver.de
 
auth on
 
user [email protected]
password yourpass

account default: [email protected]

请注意卸载任何未配置的其他 MTA 并安装msmtp-mta(它将 sendmail 符号链接到 msmtp)

相关内容