zoukankan      html  css  js  c++  java
  • matlab上发送邮件

    matlab上发送邮件的方法

    本文给出在matlab上的163/126以及QQ邮箱的配置代码。

    163邮箱配置代码

    function mail2me(subject,content)
    Mail = '******@163.com';
    password = **********';
    receive_mail='*****@qq.com';
    setpref('Internet','E_mail',Mail);
    setpref('Internet','SMTP_Server','smtp.163.com');
    setpref('Internet','SMTP_Username',Mail);
    setpref('Internet','SMTP_Password',password);
    props = java.lang.System.getProperties;
    props.setProperty('mail.smtp.auth','true');
    sendmail(receive_mail,subject,content);
    end
    

    QQ邮箱配置代码:需要添加SSL加密,以及修改端口

    function QQmail2me(subject,content)
    Mail = '******@qq.com';
    password = 'ptpkgdetcrhzttt';%QQ邮箱比较特殊,需要申请第三方客户端单独的密码
    receive_mail='receiver@qq.com';
    attachments1='result.xlsx';%附件必须在当前目录下,否则必须写明路径
    attachments2='H:documentMATLAB实验结果
    esult.xlsx';
    setpref('Internet','E_mail',Mail);
    setpref('Internet','SMTP_Server','smtp.qq.com');
    setpref('Internet','SMTP_Username',Mail);
    setpref('Internet','SMTP_Password',password);
    props = java.lang.System.getProperties;
    props.setProperty('mail.smtp.auth','true');
    props.setProperty('mail.smtp.socketFactory.class','javax.net.ssl.SSLSocketFactory');%QQ邮箱要求ssl加密
    props.setProperty('mail.smtp.socketFactory.port','465');%QQ邮箱需要修改端口为465或者587
    sendmail(receive_mail,subject,content,{attachments1,attachments2});
    end
    

    mail2me('执行结果提示','matlab中的算法执行已经结束,请查收。');

    QQmail2me('执行结果提示','matlab中的算法执行已经结束,请查收。');

    参考:http://www.cnblogs.com/ywl925/p/3574011.html

  • 相关阅读:
    一个不错的谈架构的链接
    监控报警平台设计思路
    从数据库到NoSQL思路整理
    大数据流式计算:关键技术及系统实例
    接口和类
    学习的逻辑
    [kuangbin带你飞]专题五 并查集 J
    [kuangbin带你飞]专题五 并查集 E
    [kuangbin带你飞]专题五 并查集 D
    [kuangbin带你飞]专题五 并查集 C
  • 原文地址:https://www.cnblogs.com/Lewis_Liu/p/matlab_sendemail.html
Copyright © 2011-2022 走看看