Re: Всякая всячина
Добавлено: 01 авг 2020, 02:01
Настройка отправки почты с VPS сервера через Yandex
1) Ставим ssmtp
2) Настройка подключения к Yandex
3) Правим конфиг (почты и пароли указаны вымышленные)
4) Пытаемся отправить почту
Если получает в ответ ошибку
sendmail: 553 5.7.1 Sender address rejected: not owned by auth user.
5) Прописываем алиасы в конфиге для ползователей root и test
1) Ставим ssmtp
sudo apt-get install ssmtp
2) Настройка подключения к Yandex
sudo nano /etc/ssmtp/ssmtp.conf
3) Правим конфиг (почты и пароли указаны вымышленные)
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
# root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
# mailhub=mail
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
# hostname=test.kz
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES
root=alert@test.kz
mailhub=smtp.yandex.ru:465
hostname=test.kz
UseTLS=Yes
AuthMethod=LOGIN
AuthUser=alert@test.kz
AuthPass=H@rdP@$$word
FromLineOverride=NO
4) Пытаемся отправить почту
ls | mail -s "TEST" alert@test.kz
Если получает в ответ ошибку
sendmail: 553 5.7.1 Sender address rejected: not owned by auth user.
5) Прописываем алиасы в конфиге для ползователей root и test
nano /etc/ssmtp/revaliases
# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:alert@test.kz:smtp.yandex.ru:465
test:alert@test.kz:smtp.yandex.ru:465