centos 架设mail服务器

centos7默认安装了mailx-12.5-12.el7_0.x86_64,如果没有可以在线安装
sudo yum install mailx
mailx介绍: http://blog.chinaunix.net/uid-583036-id-2090043.html
mailx配置: http://www.jb51.cc/article/p-pkzdwryr-beq.html
sendmail: http://server.51cto.com/463-164207.htm
sendmail命令: http://man.linuxde.net/sendmail
mailx只是一个发送与读取邮件的程序,我们还有一个邮件传输代理sendmail,mailx默认使用sendmail作为代理,
安装
sudo yum install sendmail #安装
sudo service sendmail start #启动
sudo chkconfig sendmail on #设置开机启动
也可以安装postfix
sudo yum install postfix
sudo service postfix start
sudo chkconfig postfix on
我安装的是sendmail,两者选一
查看sendmail状态
zabbix@zabbixServer sbin]$ service sendmail status
Redirecting to /bin/systemctl status sendmail.service
● sendmail.service - Sendmail Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/sendmail.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2016-08-09 16:27:33 CST; 14s ago
Process: 17015 ExecStart=/usr/sbin/sendmail -bd $SENDMAIL_OPTS $SENDMAIL_OPTARG (code=exited,status=0/SUCCESS)
Process: 16990 ExecStartPre=/etc/mail/make aliases (code=exited,status=0/SUCCESS)
Process: 16989 ExecStartPre=/etc/mail/make (code=exited,status=0/SUCCESS)
Main PID: 17038 (sendmail)

测试:
mail test@qq.com 按回车键
输入标题
test 按回车键
输入内容
it just a test
按回车键
ctrl+d
查看邮箱:



查看sendmail,邮箱队列
[zabbix@zabbixServer sbin]$ sudo sendmail -bp
/var/spool/mqueue is empty
Total requests: 0
删除邮件队列:
邮件队列的文件都保存在 /var/spool/mqueue/ 文件夹内,
rm -f /var/spool/mqueue/* 删除全部队列

利用SMTP发送邮件: http://blog.sina.com.cn/s/blog_4d22b97201019yav.html

相关文章

文章浏览阅读903次。4.清除缓存目录(/var/cache/yum)下的软件...
文章浏览阅读1.5k次。Python 是一种高级解释性编程语言,已被...
文章浏览阅读2.6k次。打开终端或控制台,以root或具有sudo权...
文章浏览阅读744次,点赞24次,收藏26次。目标:通过AppSrv为...
文章浏览阅读1.1w次,点赞8次,收藏26次。chmod命令来自于英...
文章浏览阅读1.2k次。yum源的URL地址,本例中是文件系统的路...