구성

구성

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

왜 메일이 전송되지 않는지 아시나요?

답변1

구성

SMTP 포트 465의 경우 TLS 시작 옵션이 선택되어 있는지 확인하세요.끄다파일에서 $HOME/.msmtprc:

defaults
auth           on
tls            on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile        /tmp/msmtp.log

account        ACCOUNT
host           mail.host.com
port           465
from           [email protected]
user           [email protected]
password       PASSWORD
tls_starttls   off

account default : ACCOUNT

또한 파일 권한이 사용자로 제한되어 있는지 확인하십시오.

chmod 600 $HOME/.msmtprc

msmtp 이메일 전송 디버깅

다음 테스트 스크립트를 사용하여 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

관련된

자세한 내용은 다음을 참조하세요.

답변2

방화벽 뒤의 CentOS 7.3에서 내 /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

관련 정보