我ssmtp在 Debian 9 和 CentOS 7 上安装了相同的版本。
德比安:
~# ssmtp -V
sSMTP 2.64 (Not sendmail at all)
中央操作系统:
# ssmtp -V
sSMTP 2.64 (Not sendmail at all)
我/etc/ssmtp/ssmtp.conf对这两个系统也有相同的配置:
root=my_user@domain.com
mailhub=mail.domain.com:587
Hostname=otherfully.qualifieddomain.com
UseTLS=Yes
UseSTARTTLS=Yes
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
AuthUser=my_user
AuthPass=my_password
AuthMethod=LOGIN
然后我通过运行以下脚本发送电子邮件:
#!/bin/bash
{
echo 'To: another_user@domain.com'
echo 'From: my_user@domain.com'
echo 'Subject: Test subject'
echo ''
echo 'Test body'
} | ssmtp -vvv 'another_user@domain.com'
在 Debian 上,此脚本退出时没有错误,退出代码为 0,并且电子邮件按预期到达。但是在 CentOS 上,它失败并出现以下错误。
# ./script.sh
[<-] 220 rn-mailsvcp-mmp-lapp04.rno.domain.com -- Server ESMTP (Oracle Communications Messaging Server 8.1.0.1.20190704 64bit (built Jul 4 2019))
[->] EHLO otherfully.qualifieddomain.com
[<-] 250 SIZE 157286400
[->] STARTTLS
[<-] 220 2.5.0 Go ahead with TLS negotiation
ssmtp: Cannot open mail.domain.com:587
据我所知,这两个配置之间的唯一区别是Debian 机器上不存在TLS_CA_File目录。/etc/pki/tls/certs/ca-bundle.crt它确实存在于 CentOS 机器上,并且包含数据。但是,如果我TLS_CA_File在 CentOS 机器上进行更改,使其指向一个不存在的文件,就像在 Debian 机器上所做的那样,我仍然会收到相同的错误。
为什么会这样?还有其他我不知道的配置文件吗?
我很感激这里的任何帮助。我也愿意接受其他简单的邮件工具的建议,这些工具可以在 Debian 和 CentOS 上始终如一地工作。