• 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

  • 相关阅读:
    java日期格式化
    Map遍历方法
    Eclipse常用快捷键
    mysql事务块处理
    oracle事务块示例
    取得服务器或应用程序当前路径
    tomcat下运行war包
    java通过CLASSPATH读取包内文件
    Hive分析窗体函数之SUM,AVG,MIN和MAX
    LeetCode 145 Binary Tree Postorder Traversal(二叉树的兴许遍历)+(二叉树、迭代)
  • 原文地址:https://www.cnblogs.com/Lewis_Liu/p/matlab_sendemail.html
Copyright © 2020-2023  润新知