首先介绍下环境与提前准备。
postfix 192.168.6.121
1.在自己的域名服务商添加 域名 与A记录,我的是内部测试也就在自己的内部DNS 上添加了 以下记录
IN MX 10 mail.ludy.com
mail IN A 192.168.6.121
2. 安装软件 postfix dovecot-pop3d sasl2 因为我是ubuntu 我就懒点,编译安装就不多说了。
shell $>
apt-get install sasl2-bin postfix dovecot-pop3d
3.修改 saslauthd 配置文件
shell $> vim /etc/default/saslauthd
START=yes
DESC="SASL Authentication Daemon"
NAME="saslauthd"
MECHANISMS="shadow"
MECH_OPTIONS=""
THREADS=5
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"
4.重启 saslauthd 服务
shell $> /etc/init.d/saslauthd restart
ln -s /var/spool/postfix/var/run/saslauthd/ /var/run/saslauthd
## 不做这步操作,验证总是报错.
shell $> adduser postfix sasl
shell $> testsaslauthd -u root -p 123
0: OK "Success."
5. 配置 dovecot pop3服务
shell $> vim /etc/dovecot/dovecot.conf
protocols = pop3 pop3s
log_timestamp = "%Y-%m-%d %H:%M:%S "
disable_plaintext_auth = no
mail_privileged_group = mail
protocol imap {
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
protocol managesieve {
sieve=~/.dovecot.sieve
sieve_storage=~/sieve
}
auth default {
mechanisms = plain login
passdb pam {
}
userdb passwd {
}
user = root
socket listen {
client {
path = /var/spool/postfix/private/auth-client
mode = 0660
user = postfix
group = postfix
}
}
}
dict {
}
plugin {
}
6.重启 dovecot 服务
shell $> /etc/init.d/dovecot restart
7.测试 dovecot pop 服务
shell $> telnet localhost 110
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user yang1
+OK
pass ypmwbg
+OK Logged in.
quit
+OK Logging out.
quit
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user yang1
+OK
pass ypmwbg
+OK Logged in.
quit
+OK Logging out.
quit
### logging 成功
8.配置 postfix 服务
shell $> vim /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = mail.ludy.com
mydomain = ludy.com
myorigin = $mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = ludy.com, mail.ludy.com, localhost.ludy.com, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth-client
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
修改 master.cf
shell $> vim master.cf
smtp inet n - - - - smtpd
替换为
smtp inet n - n - - smtpd
9.重启 postfix 服务
/etc/init.d/postfix restart
10.测试 postfix 服务smtp
shell $> telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.ludy.com ESMTP Postfix (Ubuntu)
ehlo mail.ludy.com
250-mail.ludy.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
11.添加用户
shell $> adduser yang1
shell $> adduser yang2
##密码大家自己记得啊。
12. windows outlook express 测试
a.打开 outlook 帐户选项
b.点击添加,选邮件后出现显示名字.填写自己的名字,以便对方知道你是谁:
c.电子邮件地址,写我们postfix 配置的。
d.设置 pop3 服务器,由于我们都安装在了一台机器上,都是一个mail.ludy.com
e.填写用户名密码
f.点下一步,点完成.双击败 mail.ludy.com
然后,
点确定. 然后在添加 yang2 这个用户,以便我们发收信建做测试.
f.创建邮件,yang1 发给 yang2 看是否正常:
g.点发送/接受按妞,收下邮件看 yang2是否收到!
好了,收到了,就先写这么多,如果有什么疑问,欢迎来信讨论.
本文转自Deidara 51CTO博客,原文链接:http://blog.51cto.com/deidara/172849,如需转载请自行联系原作者