How to use sendmail on macOS (Matlab 2017a)?

Hi,
I'm trying to send an email using sendmail function. Following setup works perfectly fine on Windows 10, but I'm unable to make it work on macOS Sierra.
mail = 'email@yahoo.com';
password = 'password';
setpref('Internet','SMTP_Server','smtp.mail.yahoo.com');
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');
sendmail(mail, 'My message', 'My message');
On macOS it throws following error.
Error using sendmail (line 169)
501 5.5.4 Invalid argument
Does anyone have an idea how to solve it?

Answers (1)

Products

Asked:

on 25 Oct 2017

Answered:

on 2 Dec 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!