1 |
# nano /etc/hosts |
1 |
195.64.155.22 server1.kamaok.org.ua server1 |
1.Настройка Postfix
1 |
# yum install postfix |
1 |
# cat /etc/postfix/main.cf | grep -v \# | grep -v ^$ |
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 |
queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix mail_owner = postfix myhostname = server1.kamaok.org.ua mydomain = kamaok.org.ua myorigin = $mydomain inet_interfaces = all inet_protocols = ipv4 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain unknown_local_recipient_reject_code = 550 # Указываем доверенные адреса/подсети,с которых можно отправлять почту(с остальных адресов пересылка будет запрещена на внешние почтовые ящики(в мир)(с ошибкой при отправке Relay access denied) mynetworks = 127.0.0.0/8 WWW.XXX.YYY.ZZZ in_flow_delay = 1s alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases home_mailbox = Maildir/ mail_spool_directory = /var/spool/mail smtpd_banner = $myhostname ESMTP $mail_name debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.6.6/samples readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES |
2.Добавление в автозагрузку, проверка синтаксиса и запуск Postfix
1 |
# chkconfig --level 2345 postfix on |
1 |
# /etc/init.d/postfix check |
1 |
# /etc/init.d/postfix start |
3.Тестируем работоспособность Postfix Отправка письма на внешний почтовый ящик(например,на mail.ru)
1 |
# telnet localhost 25 |
1 2 3 4 5 6 |
Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 server1.kamaok.org.ua ESMTP Postfix |
1 |
ehlo localhost |
1 2 3 4 5 6 7 8 |
250-server1.kamaok.org.ua 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN |
1 |
mail from:<username>@kamaok.org.ua |
1 |
250 2.1.0 Ok |
1 |
rcpt to:<username>@mail.ru |
1 |
250 2.1.5 Ok |
1 |
data |
1 |
354 End data with <CR><LF>.<CR><LF> |
1 2 |
Welcome to my mail server . |
1 |
250 2.0.0 Ok: queued as 125355E114F |
1 |
# tail -f /var/log/maillog |
1 2 3 |
Oct 7 22:55:13 server1 postfix/qmgr[1480]: 125355E114F: from=<<username>@kamaok.org.ua>, size=421, nrcpt=1 (queue active) Oct 7 22:55:18 server1 postfix/smtp[1489]: 125355E114F: to=<<username>@mail.ru>;, relay=mxs.mail.ru[217.69.139.150]:25, delay=38, delays=33/0/0.4/4.3, dsn=2.0.0, status=sent (250 OK id=1Xbaqr-0008Bt-9a) Oct 7 22:55:18 server1 postfix/qmgr[1480]: 125355E114F: removed |
Отправка письма самому себе
1 |
# telnet localhost 25 |
1 2 3 4 5 6 |
Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 server1.kamaok.org.ua ESMTP Postfix |
1 |
ehlo localhost |
[…]