function success=Sendmail_CFLu(address,title,message)
% Author: Lu, Chia-Feng 2014.10.2
%
% 請先啟用 "安全性較低的應用程式存取權限"
% gmail -> 帳戶設定 -> 安全性 ->帳戶權限->安全性較低的應用程式存取權限
%
% 關閉防毒軟體
success=0;

% Modify these two lines to reflect
% your account and password.
myaddress = 'matlabcflu@gmail.com';
mypassword = 'cflutest';


setpref('Internet','E_mail',myaddress);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',myaddress);
setpref('Internet','SMTP_Password',mypassword);

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');

sendmail(address, title, message);

success=1;