Red OS 7.3 настройка ssmtp

Часто бывает, что настраивать полноценный почтовый сервер на виртуалке нет ни необходимости ни желания, а почту отправлять…желание есть. Для этого и служит ssmtp. Фактически он подменяет в системе почтовую систему, и отправляет почту используя чужие почтовые сервера — например mail. yandex, gmail и т.д. Естественно понадобится учетная запись на этой почтовой системе, и открытый доступ для получения/отправки почты из вне. Далее установка и настройка ssmtp применительно к mail.yandex.ru

Установка ssmtp:

dnf install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/s/ssmtp-2.64-14.el7.x86_64.rpm

Далее откроем /etc/ssmtp/ssmtp.conf и приведем в соответствии с вашими учетными данными:

hostname=localhost
FromLineOverride=YES
AuthUser=моя_почта@yandex.ru
AuthPass=мой_пароль
smtp.yandex.ru:465
rewriteDomain=yandex.ru
UseTLS=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
DEBUG=YES

Так-же в /etc/ssmtp/revaliases нужно создать алиас вида:

root:моя_почта@yandex.ru:smtp.yandex.ru:465

И создать символическую ссылку, подменяющую sendmail:

ln -s /usr/sbin/ssmtp /usr/sbin/sendmail

На этом и всё. Попробовать отправить письмо можно прямо из консоли:

echo "Test text" | mail -s "Test title" -r моя_почта@yandex.ru donpadlo@gmail.com

ssmtp.log в /tmp

Оказывается, что у ssmtp если включить debug=yes, логи начинают писаться в /tmp/ssmtp.log и никаким способом кроме как правкой исходных кодов и перекомпиляцией пакета это не испраить. Печально..




Настройка отправки почты во FreeBSD используя ssmtp

В /etc/mail/mailer.conf создаем алиасы основных сервисов на ssmtp:

В /usr/local/etc/ssmtp/ssmtp.conf изменяем настройки для отправки почты:

#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#

# The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=billing@yarteleservice.ru www=support@yarteleservice.ru # 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.ewfwece.ru # Example for SMTP port number 2525 # mailhub=mail.your.domain:2525 # 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=erfrvice.ru # The full hostname hostname=mydomain # 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 # Use SSL/TLS certificate to authenticate against smtp host. #UseTLSCert=YES # Use this RSA certificate. #TLSCert=/usr/local/etc/ssmtp/ssmtp.pem # 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 AuthUser=bwerfewr@yfwerfwevice.ru AuthPass=fuieorf