Skip to content

Instantly share code, notes, and snippets.

@kevduc
Created September 25, 2021 22:15
Show Gist options
  • Save kevduc/e89e9c82ff9d7d7308233886e27a6123 to your computer and use it in GitHub Desktop.
Save kevduc/e89e9c82ff9d7d7308233886e27a6123 to your computer and use it in GitHub Desktop.
Example to send an email in MATLAB
myaddress = '[email protected]';
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(myaddress, 'Gmail Test', 'This is a test message.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment