linux ssmtp 错误无法打开 smtp.gmail.com:587

mac*_*akp 0 email linux tls ssmtp

我无法通过 gmail.com 发送电子邮件。我使用 ssmtp 设施。我在 /etc/ssmtp 中的配置文件是

root:yyyyy@gmail.com:smtp.gmail.com:587
maciek:yyyyy@gmail.com:smtp.gmail.com:587
Run Code Online (Sandbox Code Playgroud)

和 ssmtp.conf:

rewriteDomain=gmail.com
root=yyyyy@op.pl
maciek=yyyyy@op.pl
hostname=yyyyyy@gmail.com
UseTLS=YES
UseSTARTTLS=YES
AuthUser=yyyyy@gmail.com
AuthPass=MyPass
FromLineOverride=YES
Run Code Online (Sandbox Code Playgroud)

所以我尝试:

# mail yyyyy@orange.pl
Subject: ddd
ddd
.
EOT
# send-mail: Cannot open smtp.gmail.com:587
Run Code Online (Sandbox Code Playgroud)

没有什么会阻止到 Gmail 服务器的流量,如下所示:

$ telnet smtp.gmail.com 587
Trying 173.194.70.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 mx.google.com ESMTP n1sm56130900eep.20 - gsmtp
ehlo
250-mx.google.com at your service, [83.25.153.55]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 CHUNKING
quit
221 2.0.0 closing connection n1sm56130900eep.20 - gsmtp
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)

来自我的系统 journalctl 的日志:

Dec 11 22:45:55 piotr sSMTP[7571]:
Creating SSL connection to host Dec 11 22:45:55 piotr sSMTP[7571]:
SSL not working: certificate verify fail...0) Dec 11 22:45:55 piotr sSMTP[7571]:
Cannot open smtp.gmail.com:587
Run Code Online (Sandbox Code Playgroud)

此计算机上未安装其他 MTA 代理(如 sendmail)。那我配置错了什么?

小智 6

你有没有检查你的selinux是否启用?

此外,您可能需要此选项:

  • TLS_CA_Dir
    • 如果需要,用于验证服务器的可信证书目录。

基本上告诉你的系统你的 CA 证书在哪里,这样它就不会认为 Gmail 有一个无效的证书。

  • 好的。谢谢。你帮我。有用!我只是添加行:TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt (2认同)