首页 Linux正文

安装mail服务

王昊 Linux 2019-12-05 326 0

cd /usr/local/

wget http://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5.orig.tar.gz

wget http://www.linuxfromscratch.org/patches/blfs/7.9/heirloom-mailx-12.5-fixes-1.patch

tar zxvf heirloom-mailx_12.5.orig.tar.gz

给mailx打补丁,把heirloom-mailx-12.5-fixes-1.patch放在heirloom-mailx_12.5同级目录下

yum -y install patch

patch -p0 <heirloom-mailx-12.5-fixes-1.patch

tar zxvf heirloom-mailx_12.5.orig.tar.gz

cd heirloom-mailx-12.5

make && make install UCBINSTALL=/usr/bin/install

mail -V

12.5 7/5/10

vim /etc/nail.rc

set from=xxx@xxx.com
set smtp=smtp.xxx.com
set smtp-auth-user=xxx@xxx.com
set smtp-auth-password=xxx
set smtp-auth=login

from:对方收到邮件时显示的发件人
smtp:指定第三方发邮件的smtp服务器地址
set smtp-auth-user:第三方发邮件的用户名
set smtp-auth-password:用户名对应的密码,有些邮箱填的是授权码(例如163邮箱,授权码在–设置–SMTP)
smtp-auth:SMTP的认证方式,默认是login,也可以改成CRAM-MD5或PLAIN方式

安装sendmail

yum -y install sendmail

启动sendmail

service sendmail start

测试是否能发送邮件:

echo “test” | mail -s “root” wh1647458225@163.com

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

评论