标签:postfix
yum install postfix dovecot cyrus-sasl
# vi /etc/postfix/main.cf
myhostname = mail.wc365.com
mydomain = wc365.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
mail.$mydomain, www.$mydomain, ftp.$mydomain
mynetworks = 127.0.0.0/8
relay_domains = $mydestination
message_size_limit = 1073741824
default_process_limit = 50
default_destination_concurrency_limit = 20
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_application_name = smtpd
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
# systemctl start postfix.server(检查25号端口)
# vi /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
listen = *
# systemctl start dovecot.server(检查110,143号端口)
# vi /etc/sysconfig/saslauthd
SOCKETDIR=/var/run/saslauthd
MECH=shadow
# cat /etc/sasl2/smtpd.conf
pwcheck_method: saslauthd
mech_list: plain login
# systemctl start saslauthd.server
测试1:
# telnet mail.wc365.com 25
Trying 192.168.1.2...
Connected to mail.wc365.com (192.168.1.2).
Escape character is ‘^]‘.
220 mail.yjw.com ESMTP Postfix
EHLO 163.com(只需要输入该行即可,一下都是现实信息)
250-mail.wc365.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit(输入退出命令)
221 2.0.0 Bye
Connection closed by foreign host.
测试2:
echo "this is a test mail" | mail -s mailname qq号@qq.com(查看QQ邮箱是否有新邮件)
报错1:postfix/sendmail[13310]: fatal: parameter inet_interfaces: no local interface found for ::1
解决1:
vi /etc/postfix/main.cf
#inet_protocols = all(注释掉该行)
#wc add1
inet_protocols = ipv4
systemctl start postfix(检查端口号查看是否起来)
报错2:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (111)
解决2:ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
标签:postfix
原文地址:http://guowang327.blog.51cto.com/6513732/1729098