Ubuntu带账号认证发邮件



邮箱协议端口:

POP3:TCP 110 ,SMTP:TCP 25  SMTP SSL:TCP 587

  



Ubuntu 16.04、18.04、20.04(heirloom-mailx用s-nail替换了):


# apt-get install s-nail

# vi /etc/s-nail.rc


set smtp-use-starttls

set ssl-verify=ignore

set smtp=10.0.0.4:587

set from=zhi.yang@ming.com

set smtp-auth-user=zhi.yang@ming.com

set smtp-auth-password=123456

set smtp-auth=login


:wq






Ubuntu 14.04:


安装heirloom-mailx

# apt-get install heirloom-mailx


修改/etc/nail.rc(最后添加)


set from=zhi.yang@ming.com

set smtp=10.0.0.4:587

set smtp-auth-user=zhi.yang@ming.com

set smtp-auth-password=123456

set smtp-auth-login

:wq


# s-nail -s "aa" aa.yang@ming.com bb.yang@ming.com < /aa.log   (收件人多人中间为空格)



Redhat 6.8系统是安装mailx,配置文件为/etc/mail.rc


如果公司用的是exchange邮箱端口587且启用了TLS,则设置如下,并需在exchange管理端启用“User NT AUTHORITY\SELF is listed”


set nss-config-dir=/etc/pki/nssdb

set smtp-use-starttls

set ssl-verify=ignore

set from=zhi.yang@ming.com

set smtp=10.0.0.4:587

set smtp-auth-user=zhi.yang@ming.com

set smtp-auth-password=123456

set smtp-auth-login