1. In order to send mail from the GMail server, the first step is that you have to decrease the security level of your Gmail settings, enable it by clicking here
2. You can run the following snip code directly or save them as a script file and run it
mail = 'YOUR_ACCOUNT@gmail.com'; % your Gmail address
password = 'YOUR_PASSWORD; % your Gmail password
host = 'smtp.gmail.com';
sendto = 'MAIL-TO-ADDRESS'; % the e-mail address that you want to send to
Subject = 'test subject';
Message = 'test message';
% preferences
setpref('Internet','SMTP_Server', host);
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Username',mail);
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','465');
% execute
sendmail(sendto,Subject,Message)
留言列表