MATLAB发邮件

跑程序的时候,一边玩去吧,让MATLAB提醒你什么时候运行完毕。

function MailToMe(subject,content)
% 功能:给自己发送邮件
% 输入:subject 邮件的标题
%      content 邮件的内容
% liutongqing 2016/04/30

if nargin == 0
    subject = 'Program Completed By your name';
    content = {'This is an automatic e-mail send by Matlab, please do not reply.';...
        '                  your name';...
        ['             ',datestr(now,31)]};
elseif nargin ~= 2
    error('MailToMe must contain two items: subject and content')
end
MailAddress = '******@139.com'; %这里是你的邮箱
password = '******'; %这里是你的邮箱密码
setpref('Internet','E_mail',MailAddress);
setpref('Internet','SMTP_Server','smtp.139.com'); %这里是对应邮箱的smtp
setpref('Internet','SMTP_Username',MailAddress);
setpref('Internet','SMTP_Password',password);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
sendmail('******@qq.com',subject,content); %这里是目标邮箱

在程序末添加命令
MailToMe
就行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值