В продолжение темы. Нужно настроить почту для сайта только на отправку.
Устанавливаем
# yum install certbot # yum install cyrus-sasl-plain # service postfix restart
Порт 25 заблокирован хостером, поэтому настроим на 587.
# mkdir /etc/postfix/sasl # cat sasl_passwd [smtp.gmail.com]:587 user_gmail@gmail.com:__PASSWORD__ # postmap /etc/postfix/sasl/sasl_passwd
# chmod 600 sasl_passwd
Редактируем main.cf
myhostname = aws.tst-amo.net.ua
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8
relayhost = [smtp.gmail.com]:587
# Enables SASL authentication for postfix
smtp_sasl_auth_enable = yes
# Disallow methods that allow anonymous authentication smtp_sasl_security_options = noanonymous
# Location of sasl_passwd we saved
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
# Enable STARTTLS encryption for SMTP
smtp_tls_security_level = encrypt
# Location of CA certificates for TLS
smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
smtp_sasl_security_options = noanonymous
# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/aws.tst-amo.net.ua/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/aws.tst-amo.net.ua/privkey.pem
smtp_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
В master.cf раскоментировать строку (включаем 587 порт)
submission inet n - n - - smtpd
Проверяем
# echo "Test Postfix Gmail https://example.com" | mail -s "Postfix Gmail" to_user@domen.com
https://medium.com/yavar/send-mail-using-postfix-server-bbb08331d39d
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-22-04

