-
Notifications
You must be signed in to change notification settings - Fork 0
/
pitt_sendMail.m
44 lines (37 loc) · 1.19 KB
/
pitt_sendMail.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function pitt_sendMail(subject, emailTo, emailFrom, message,attachment)
% function emailMe([subject], emailTo, [emailFrom], [message],[attachment])
%
% email a message. it is useful to call this function immediatley after
% starting a long process in order to know when it is done. The message
% will show up as the subject title.
%
% You can also send an attachment, which is useful if you're writing the
% outputs of your script to a log file - you can send that file to yourself
% for quick review. Multiple attachemnts can be sent if the file names are
% in a cell array
%
% Example:
% status=['Preprocessed this subject successfully'];
% attachment = 'path to some file';
% emailMe(status,'[email protected]');
%
%%
if notDefined('subject')
subject = 'MATLAB has sent you an email!';
end
if notDefined('emailTo')
error('You need to specify an @pitt.edu address to send the email to');
end
if notDefined('emailFrom')
emailFrom = emailTo;
end
if notDefined('message')
message = subject;
end
if notDefined('attachment')
attachment = [];
end
setpref('Internet','SMTP_Server','smtp.pitt.edu');
setpref('Internet','E_mail',emailFrom);
sendmail(emailTo, subject, message, attachment);
return