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