install arch
|
1 2 3 4 5 6 |
#archlinux pacman -S logwatch pacman -S postfix pacman -S postfix-lmdb pacman -S mailutils pacman -S s-nail |
config postfix:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
Создаем конфиги: mkdir /etc/postfix/private #canonical - переписывает адреса отправителей и получателей cat > /etc/postfix/private/canonical << "EOF" @yandex.ru YOU_EMAIL_YANDEX_FOR_SENT_MAIL_YANDEX@yandex.ru EOF #generic - переписывает ЛОКАЛЬНЫЕ адреса отправителей (без домена) cat > /etc/postfix/private/generic << "EOF" root@YOU_HOST.localdomain YOU_EMAL@YOU_DOMAIN @YOU_DOMAIN YOU_EMAIL_YANDEX_FOR_SENT_MAIL_YANDEX@yandex.ru EOF #sasl_passwd - учетная запись для отправки почты cat > /etc/postfix/private/sasl_passwd << "EOF" [smtp.yandex.ru] YOU_EMAIL_YANDEX_FOR_SENT_MAIL_YANDEX@yandex.ru:YOU_PASSWORD EOF #sender_relay - тут мы указываем через кого почту отправлять cat > /etc/postfix/private/sender_relay << "EOF" @yandex.ru smtp.yandex.ru EOF cat > /etc/postfix/main.cf << "EOF" mydestination = localhost relayhost = mynetworks = 127.0.0.0/8 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = ipv4 #send yandex # для arch hash поменять на lmdb relayhost = smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/private/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sasl_type = cyrus smtp_sasl_mechanism_filter = login smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/private/sender_relay sender_canonical_maps = hash:/etc/postfix/private/canonical smtp_generic_maps = hash:/etc/postfix/private/generic EOF cat > /etc/aliases << "EOF" # /etc/aliases mailer-daemon: postmaster postmaster: root nobody: root hostmaster: root usenet: root news: root webmaster: root www: root ftp: root abuse: root noc: root security: root root: YOU_MAIL@yandex.ru EOF После создания файлов нужно обязательно создать db файлы: newaliases postmap /etc/postfix/private/sasl_passwd postmap /etc/postfix/private/sender_relay postmap /etc/postfix/private/generic postmap /etc/postfix/private/canonical Включение таймера и запуск postfix: systemctl enable postfix systemctl start postfix systemctl start logwatch.timer systemctl enable logwatch.timer Смотрим логи: journalctl -f -u postfix Запуск logwatch: /usr/sbin/logwatch --output mail Тестовое письмо: echo "test" | mail -s "test" YOU_MAIL@yandex.ru |