1, 安装 sudo apt-get install sendmail
sudo apt-get install sendmail-cf
sudo apt-get install bsd-mailx
sudo apt-get install mailutils
sudo apt-get install sharutils
安装后
终端输入命令:ps aux |grep sendmail
看是否有sendmail进程在运行
输出如下:
root 20978 0.0 0.3 8300 1940 ? Ss 06:34 0:00 sendmail: MTA: accepting connections
root 21711 0.0 0.1 3008 776 pts/0 S+ 06:51 0:00 grep sendmail
说明sendmail 已经安装成功并启动了
如果要php调用sendmail的话需要修改php.ini配置文件
sendmail_path = /usr/sbin/sendmail -t -i #添加一条这个
2,Sendmail默认只会为本机用户发送邮件,要它可以对internet发的话, 先打开Sendmail的配置宏文件/etc/mail/sendmail.mc。找到Port=smtp, Addr=127.0.0.1')dnl 改成 Port=smtp, Addr=0.0.0.0')dnl , 保存
[[email protected] ~]#cd /etc/mail
[[email protected] ~]#mv sendmail.cf sendmail.org ;备份原来的Sendmail配置文件
[[email protected] ~]#m4 sendmail.mc > sendmail.cf ;生成新的Sendmail配置文件
好了,测试, echo "test mail ok" | mail -s "test mail ok" [email protected]
[email protected] 填写为你自己的邮箱,过段时间你的邮箱会收到一个字样为test mail ok的信件就代表成功了。
当然你如果防火墙有限制25的话,那就需要去开启