• CentOS 6.5 and Ubuntu 14.04 使用外部邮箱发送邮件


    我们可以使用外部邮箱(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

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

  • 相关阅读:
    C++中的extern "C"【转】
    无题
    MATLAB中文件的读写和数据的导入导出【转】
    逝去的2012
    C/C++语言中Static的作用详述
    C++:源文件与头文件有什么区别【转】
    Bash,后台与nohup
    关于include 和 extern
    python易错点
    android实现点击两次返回键实现退出功能
  • 原文地址:https://www.cnblogs.com/jamesf/p/4751484.html
Copyright © 2020-2023  润新知