1. mail介绍
1.1 mail简单介绍
(1)相关协议
pop3:post office protocol 相当于邮局,存放邮件的地方,目前常用的一种协议
smtp:简单邮件传输协议,用来投递邮件,相当于邮差
smtp端口:25 仅用来实现邮件路由和传递
1.2 mail相关命令及管理
使用mail发邮件时,必须先将sendmail服务启动。
mail –s “邮件主题” –c”抄送地址” –b “密送地址” -- -f 发送人邮件地址 –F 发件人姓名 < 要发送的邮件内容
三种常用格式发信
mail -s test nebula@nebula.edu.cn #第一种方法,你可以把当前shell当成编辑器来用,编辑完内容后 Ctrl-D结束
echo “mail content”|mail -s test nebula@nebula.edu.cn #第二种方法,使用管道的缘故
mail -s test nebula@nebula.edu.cn < file #第三种方法,以file的内容为邮件内容发信
2. mail配置
2.1 安装sendmail或者postfix(邮件传送代理MTA)
说明:此处使用postfix
[root@localhost ~]# rpm -qa postfix
postfix-2.10.1-7.el7.x86_64
[root@localhost ~]# systemctl start postfix
[root@localhost ~]# systemctl status