如何使用 Gmail 帐户通过 OpenBSD 上的控制台发送邮件?

如何使用 Gmail 帐户通过 OpenBSD 上的控制台发送邮件?

存在证书错误:

# echo "hello" | msmtp -a default [email protected]
msmtp: TLS certificate verification failed: unable to get local issuer certificate
msmtp: could not send mail (account default from /root/.msmtprc)
#

在配置文件中:

# cat .msmtprc
# Set default values for all following accounts.
defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        ~/.msmtp.log

# Gmail
account         gmail
host            smtp.gmail.com
port            587
from            [email protected]
user            FOOBAR
password        BARFOO

# Set a default account
account default : gmail
#

但我那里有证书!

# uname -mrs
OpenBSD 6.0 amd64
#
# cksum /etc/ssl/cert.pem /etc/ssl/certs/ca-certificates.crt
1384454833 189049 /etc/ssl/cert.pem
1384454833 189049 /etc/ssl/certs/ca-certificates.crt
#

日志只说:

# cat .msmtp.log
Aug 22 20:43:14 host=smtp.gmail.com tls=on auth=on user=FOOBAR [email protected] [email protected] errormsg='TLS certificate verification failed: unable to get local issuer certificate' exitcode=EX_UNAVAILABLE
#

为什么无法识别证书?

答案1

删除该文件/etc/ssl/certs/ca-certificates.crt并更改tls_trust_file/etc/ssl/cert.pem.

相关内容