The official Matlab blog featured a short article recently on a function that could be of use to some people: ‘sendmail’. If you set it up correctly, Matlab can send out e-mails to keep you updated on its progress while you’re away from your work computer, or automatically e-mail you the data as soon as a subject finishes an experiment.
http://blogs.mathworks.com/loren/2010/09/16/my-first-use-of-sendmail/?s_cid=fb_wall_loren_sendmail
For instance, to send from your kuleuven e-mail, you could use something like this.
address = 'yourname@gmail.com'; % The e-mail address to which to send
subject = 'Matlab progress report'; % The e-mail subject
message = 'Matlab finished creating your stimuli'; % The body of the message
attachname = 'stimuli.mat'; % An attachment
mail = 'yourname@psy.kuleuven.be'; % The e-mail address from which to send
username = 'u0000000'; % Your u-number
password = 'mypassword'; % Your password
% Settings for kuleuven e-mail sending
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Server','smtps.kuleuven.be');
setpref('Internet','SMTP_Username',username);
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');
props.setProperty('mail.smtp.socketFactory.port','443');
% Sendmail example without attachment
sendmail(address,subject,message)
% Sendmail example with attachment
sendmail(address,subject,message,'stimuli.mat')
Beware though, having your KUL password saved in a plain text m-file can be a security risk. You could try to use a less sensitive e-mail account if this bothers you, or be more inventive in how you enter the password into the program (e.g., load it from a .mat file, make up or download a simple encryption routine,…).
Greetings,
Maarten
Geen opmerkingen:
Een reactie posten