[b4b313]: / Semantic Features / matlabMail.m

Download this file

26 lines (18 with data), 833 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function [ errorCode ] = matlabMail( targetaddress, message )
%matlabMail send an email with a message
% Useful to let you know when matlab finishes a long computation.
% Googled/copy paste by Ethan S.
errorCode = 0;
myaddress = 'matlab.notifications.medix@gmail.com';
mypassword = 'ethan_is_an_ai';
setpref('Internet','E_mail',myaddress);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',myaddress);
setpref('Internet','SMTP_Password',mypassword);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', ...
'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');
sendmail(targetaddress, 'Matlab Notification', message);
end