跑程序的时候,一边玩去吧,让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
就行