Msmtpでメールを送信しようとしましたが成功しませんでした
構成ファイル:〜/ .msmtprc
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
logfile ~/.msmtp.log
account iisr
Host smtp.yandex.com
port 465
user [email protected]
from [email protected]
password ********
コマンドecho "hello there username." | msmtp -a iisr [email protected]
でテストすると、結果はまったくなく、ログファイルにもありません。
以下の回答で@Andrezjによるスクリプトを使用すると、次の出力が得られ、次のようになります。
ignoring system configuration file /etc/msmtprc: No such file or directory
loaded user configuration file /home/bakenoor/.msmtprc
using account iisr from /home/bakenoor/.msmtprc
Host = smtp.yandex.com
port = 465
timeout = off
protocol = smtp
domain = localhost
auth = choose
user = [email protected]
password = *
passwordeval = (not set)
ntlmdomain = (not set)
tls = on
tls_starttls = on
tls_trust_file = /etc/ssl/certs/ca-bundle.crt
tls_crl_file = (not set)
tls_fingerprint = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = on
tls_force_sslv3 = off
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from = [email protected]
dsn_notify = (not set)
dsn_return = (not set)
keepbcc = off
logfile = /home/bakenoor/.msmtp.log
syslog = (not set)
aliases = (not set)
reading recipients from the command line and the mail
メールが送信されない理由はありますか?
次のテストスクリプトを使用して、SMTPセッションの完全なトランスクリプトを取得します
#!/bin/sh
# msmtp specific options
# -d : debug
# -a : account name
# sendmail compatibility options
# -i : ignored for sendmail capability
# -t : Read recipient addresses from the To, Cc, and Bcc headers
msmtp -d -a iisr -i -t <<END
From: [email protected]
To: [email protected]
Subject: test
test
END
ファイアウォールの背後にあるCentOS7.3では、My/etc/msmtprc:
defaults
logfile /var/log/msmtp.log
domain localhost
auth on
port 465
Host smtp.gmail.com
tls on
tls_starttls off
auth on
tls_trust_file /etc/ssl/certs/ca-bundle.crt
# gmail account
account workflow
user *[email protected]*
from *[email protected]*
password *mypassword*
# set default account to use
account default : workflow