Конфигурация

Конфигурация

Я пытался отправить почту с помощью 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 убедитесь, что опция Start 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

Связанный контент