Найти в Дзене
ITapi.su

Настройка Postfix для отправки почты

Рассмотрим настройку отправки почтовых сообщений postfix-ом через Яндекс: 1. устанавливаем дополнительные пакеты yum install cyrus-sasl-plain 2. добавляем в файл /etc/postfix/main.cf smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/mailpasswd
smtp_sasl_security_options = noanonymous
smtp_sasl_type = cyrus
smtp_sasl_mechanism_filter = login
smtp_sender_dependent_authentification = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
sender_canonical_maps = hash:/etc/postfix/canonical
smtp_generic_maps = hash:/etc/postfix/generic
smtp_use_tls = yes 3. в /etc/postfix/mailpasswd указываем логин и пароль [smtp.yandex.ru]      www@site.ru:password 4. в /etc/postfix/sender_relay указываем привязку доменов и конкретных отправителей к внешним службам @site.ru [smtp.yandex.ru]
www@site.ru [smtp.yandex.ru] 5. в /etc/postfix/canonical добавляем для домена указание через какой аккаунт отправлять @site.ru   www@site.ru  6. в /etc/postfix/generic добавля

Рассмотрим настройку отправки почтовых сообщений postfix-ом через Яндекс:

1. устанавливаем дополнительные пакеты

yum install cyrus-sasl-plain

2. добавляем в файл /etc/postfix/main.cf

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/mailpasswd
smtp_sasl_security_options = noanonymous
smtp_sasl_type = cyrus
smtp_sasl_mechanism_filter = login
smtp_sender_dependent_authentification = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
sender_canonical_maps = hash:/etc/postfix/canonical
smtp_generic_maps = hash:/etc/postfix/generic
smtp_use_tls = yes

3. в /etc/postfix/mailpasswd указываем логин и пароль

[smtp.yandex.ru]      www@site.ru:password

4. в /etc/postfix/sender_relay указываем привязку доменов и конкретных отправителей к внешним службам

@site.ru [smtp.yandex.ru]
www@site.ru [smtp.yandex.ru]

5. в /etc/postfix/canonical добавляем для домена указание через какой аккаунт отправлять

@site.ru   www@site.ru 

6. в /etc/postfix/generic добавляем отправку почты админу

root@localhost admin@site.ru 
bitrix@localhost admin@site.ru 

и выполняем команду postmap для /etc/postfix/generic, /etc/postfix/canonical, /etc/postfix/sender_relay,  /etc/postfix/mailpasswd

7. изменяем настройки в php.ini

sendmail_path = sendmail -t -i -f www@site.ru

8. Запускаем все необходимые службы

chkconfig saslauthd on
service saslauthd restart  
chkconfig postfix on
service postfix restart
service httpd restart

Источник: https://www.itapi.su/nastrojka-postfix-dlja-otpravki-pochty/