from
TxtMsg Create
by Robert M. Flight
GUI generates a function useful for sending text messages from Matlab
|
| example_txtmsg(varargin) |
% Sends a text message with the supplied Message and Subject. Can take
% both, or only one.
function example_txtmsg(varargin)
messag = 'Job Completed';
sub = 'Matlab Job';
if exist('varargin')
if length(varargin) == 1
sub = varargin{1};
elseif length(varargin) == 2
sub = varargin{1};
messag = varargin{2};
end %if
end %if
gm = 'example@gmail.com'; pw = 'password_here';
pn = '1234567890@somecarrier.com';
setpref('Internet','E_mail',gm);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',gm);
setpref('Internet','SMTP_Password',pw);
% The following four lines are necessary only if you are using GMail as
% your SMTP server. Delete these lines wif you are using your own SMTP
% server.
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');
%% Send the email
sendmail(pn,sub,messag)
|
|
Contact us at files@mathworks.com