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

  • 相关阅读:
    微信公众号对接配置
    ASP.NET MVC5+EF6+EasyUI 后台管理系统(89)-国际化,本地化,多语言应用
    Nacos安装教程
    IDEA 中创建SpringBoot 父子模块
    解决死锁之路(终结篇)
    CentOS安装node和npm
    CentOS安装RabbitMQ
    在LibreOffice中插入代码
    PowerShell查找程序路径
    使用命令行调用控制面板的选项
  • 原文地址:https://www.cnblogs.com/Lewis_Liu/p/matlab_sendemail.html
Copyright © 2011-2022 走看看