我们可以使用外部邮箱(163,126,gmail,139等等)为我们发邮件

for CentOS 6.5

yum -y install mailx


vi /etc/mail.rc
在文件的末行添加以下5行

set from=yuorname@139.com
set smtp=smtp.139.com
set smtp-auth-user=yourname
set smtp-auth-password=yourpassword
set smtp-auth=login


不用重启,立刻生效

测试:

echo "输出任务完成情况" | mailx -s ubuntumail  myemail@126.com

说明:
from: 发送的邮件地址
smtp: 发生的外部smtp服务器的地址
smtp-auth-user: 外部smtp服务器认证的用户名
smtp-auth-password: 外部smtp服务器认证的用户密码
smtp-auth: 邮件认证的方式


for Ubuntu 14.04

aptitude -y install mailutils ssmtp

vi /etc/ssmtp/ssmtp.conf

root=yourname@139.com
mailhub=smtp.139.com
AuthUser=yourname
AuthPass=your-password
rewriteDomain=139.com
hostname=smtp.139.com

vi /etc/ssmtp/revaliases

root:yourname@139.com:smtp.139.com

echo "test mail" | mail -s "test mail" email-you-want-to-send


或者用sendemail

aptitude -y install sendemail


sendEmail -s smtp.139.com -xu account-name -xp account-pass -f account@139.com -u "test" -m "test" -ttarget-account@189.cn

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章:

  • 2021-08-31
  • 2021-09-16
  • 2021-08-31
  • 2021-07-13
  • 2022-12-23
  • 2021-12-26
  • 2021-12-07
猜你喜欢
  • 2021-11-17
  • 2022-01-24
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-28
相关资源
相似解决方案