ssmtp:无法打开邮件:25

ssmtp:无法打开邮件:25

我已经安装了 ssmtp,然后编辑了 ssmtp.conf 文件,因此可以尝试发送邮件,但说无法打开邮件:25,但是在 conf 文件中我将其设置为 gmail 端口 467,我很确定其他一切都是正确的。

对于此错误,我具体需要查找什么,或者可能是配置文件内外的任意数量的设置?

#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# See the ssmtp.conf(5) man page for a more verbose explanation of the
# available options.
#

# The person who gets all mail for userids < 500
# Make this empty to disable rewriting.
root=postmaster

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
mailhub=mail

# Example for SMTP port number 2525
mailhub=smtp.gmail.com:465
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
# mailhub=mail.your.domain:465

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

# The full hostname
#Hostname=

# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
#FromLineOverride=YES

# Use SSL/TLS to send secure messages to server.
UseTLS=YES
UseSTARTTLS=YES
[email protected]
AuthPass=xxxxxx

# Use SSL/TLS certificate to authenticate against smtp host.
#UseTLSCert=YES

# Use this RSA certificate.
#TLSCert=/etc/pki/tls/private/ssmtp.pem
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

# Get enhanced (*really* enhanced) debugging information in the logs
# If you want to have debugging of the config file parsing, move this option
# to the top of the config file and uncomment
#Debug=YES

有趣的是,其中的所有文件都/etc/pki/tls/certs/与我在 /etc/ssl 文件夹中删除的文件完全相同!哈哈现在我知道创建不受信任的证书时发生了一定量的业务。

答案1

第一个未注释的mailhub=mail似乎是造成这种情况的原因。

如果没有 FQDN 和端口号,我想它会配置ssmtp为尝试在端口 25 上连接到mail默认域中调用的主机(但是您在本地设置了该主机),而该主机可能不存在。

答案2

ssmtp: Cannot open mail:25 

可能是由 上的文件权限错误引起的/etc/ssmtp/ssmtp.conf。无论尝试运行什么应用程序都ssmtp无法读取该文件。

chmod 640 /etc/ssmtp/ssmtp.conf
chown root:mail /etc/ssmtp/ssmtp.conf

并添加向组发送电子邮件的应用程序mail(例如,logcheck如果它不属于adm组)

为了完整起见,你smtp.conf应该看起来像:

[email protected]
mailhub=your-mailserver.com:465
#mailhub=gmail.com:587 ### -> note 587 for STARTTLS
hostname=your-vps.com
UseTLS=Yes
#UseSTARTTLS=Yes ### => gmail needs this (not all servers do)
AuthUser=xxxxxx
AuthPass=xxxxxx
FromLineOverride=NO
#Debug=YES

# on Fedora / Red Hat / or with ssmtp-validate-TLS-server-cert.patch
TLS_CA_File=/etc/ssl/certs/ca-certificates.crt

答案3

这样的事情我也经历过!!

互联网上没有答案给我想要的结果。

在使用 ssmtp 发送邮件之前,请确保您已安装所有必需的存储库和软件包。

尝试执行这些命令..之后,它真的对我有用!

mv /usr/sbin/sendmail /usr/sbin/sendmail.ORIG
ln -s /usr/sbin/ssmtp /usr/sbin/sendmail

相关内容