我已经安装了 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
AuthUser=user@gmail.com
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
Run Code Online (Sandbox Code Playgroud)
有趣的是,其中的所有文件/etc/pki/tls/certs/都与我在 /etc/ssl 文件夹中删除的完全相同!哈哈 现在我知道在创建不受信任的证书时发生了一定数量的业务。
ssmtp: Cannot open mail:25
Run Code Online (Sandbox Code Playgroud)
可能是由 上的文件权限错误引起的/etc/ssmtp/ssmtp.conf。无论尝试运行什么应用程序都ssmtp无法读取该文件。
chmod 640 /etc/ssmtp/ssmtp.conf
chown root:mail /etc/ssmtp/ssmtp.conf
Run Code Online (Sandbox Code Playgroud)
并添加向组发送电子邮件的应用程序mail(例如logcheck,如果它不属于adm组)
为了完整起见,你smtp.conf应该看起来像:
root=you@domain.com
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
Run Code Online (Sandbox Code Playgroud)
sSMTP使用256 bit密码并验证CA.| 归档时间: |
|
| 查看次数: |
47165 次 |
| 最近记录: |