1、协议服务:
SMTP tcp 25 端口 邮件存储和递送
POP3 tcp 110 端口 用户读、写邮件2、服务器: (SMTP 25 端口)
sendmail 成熟,易配置
postfix AIX系统开发 (IBM) 所以Linux下 不易配置
gmail 号称 处理速度快,能力强
3、客户端: (POP3 110 端口)
文本: mutt
图形: foxmail evolution
一、 配置mail域名服务器
[[email protected] root]# vi /var/named/gr.org.db
$TTL 86400 @ IN SOA ns.gr.org. root.gr.org.( 20140308 ;serial 8H ;refresh 4M ;retry 1W ;expiry 1D ) ;minimum @ IN NS ns.gr.org. ns IN A 192.168.170.1 host1 IN A 192.168.170.1 host2 IN A 192.168.170.2 host3 IN A 192.168.170.3 @ IN MX 10 mail.gr.org. mail IN A 192.168.170.1重启服务
[[email protected] root]# rndc reload
测试
[[email protected] root]# nslookup -sil mail.gr.org
Server: 192.168.170.3
Address: 192.168.170.3#53Name: mail.gr.org
Address: 192.168.170.1
二、sendmail 配置
1、看sendmail是否安装好
[[email protected] root]# cd /etc/mail
[[email protected] mail]# rpm -q sendmail
sendmail-8.12.8-4(sendmail 配置 实验 关键步骤 :
修改sendmail.mc ,再通过 m4 生成 sendmail.cf
修改local-host-name 设置 收信的域
access(访问控制) 通过 makemap 生成 access.db
aliases 设置群发 通过 newaliases 生成 aliases.db
service sendmail restart (重启服务)
)2、配置核心文件:
[[email protected] mail]# vi /etc/mail/sendmail.mc
更改地方如下面3个
1) 侦听网段
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA‘)dnl
改为
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA‘)dnl2) 本地域名
LOCAL_DOMAIN(`localhost.localdomain‘)dnl
改为
LOCAL_DOMAIN(`gr.org‘)dnl3) 开启认证功能:
把下面三行中行首的 dnl 去掉:dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea‘)
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN‘)dnl
dnl define(`confAUTH_MECHANISMS‘, `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN‘)dnl3、建立 /etc/mail/sendmail.cf
[[email protected] mail]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf4、设置收件的域
[[email protected] mail]# vi /etc/mail/local-host-namesgr.org
mail.gr.org5、建立组和用户
[[email protected] mail]# groupadd stu
[[email protected] mail]# useradd huji -g stu -s /sbin/nologin
[[email protected] mail]# passwd huji
Changing password for user huji.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] mail]# useradd stu -g stu -s /sbin/nologin
[[email protected] mail]# passwd stu
Changing password for user stu.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.[[email protected] root]# useradd wuji -g stu -s /sbin/nologin
[[email protected] root]# passwd wuji
Changing password for user wuji.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.6、设置群发别名:
[[email protected] mail]# vi /etc/aliases
添加两行:
root: root,yanji
stu: yanji,wuji,huji7、生成 aliases.db 数据库:
[[email protected] mail]# newaliases /etc/aliases: 64 aliases
/etc/aliases: 65 aliases, longest 15 bytes, 657 bytes total8、设置访问控制:
[[email protected] mail]# vi /etc/mail/access
192.168.170.0/24 RELAY
gr.org RELAY
mail.gr.org RELAY9、更新 aliases.db 数据库
[[email protected] mail]# makemap -r hash /etc/mail/access.db < /etc/mail/access10、重启服务
[[email protected] mail]# service sendmail restart
关闭 sendmail: [ 确定 ]
关闭 sm-client: [ 确定 ]
启动 sendmail: [ 确定 ]
启动 sm-client: [ 确定 ]
现在来测试
方法一、
发邮件:(给yanji写信 主题:Greet 内容:Hello, yanji.)
[[email protected] mail]# echo "Hello, yanji." | mutt -s "Greet" [email protected]
查看邮件
[[email protected] mail]# su - yanji
[[email protected] yanji]$ zh
[[email protected] yanji]$ muttyes,回车
方法二、
在Windows用foxmail验证
[[email protected] root]# chkconfig ipop3 on
[[email protected] root]# service xinetd restart
停止 xinetd: [ 确定 ]
启动 xinetd: [ 确定 ]
禁用本地连接,不让上网。 把VMware8 的DNS服务器指定为 192.168.170.3.
foxmail新增yanji帐号
群发
先创建huji 和wuji的帐号
发邮件给stu,就会给这个stu组 所有的成员发邮件
[[email protected] root]# echo "Hello, student." | mutt -s "Greet" [email protected]
验证如下