MATLAB Answers

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

5 views (last 30 days)
Martin Strambach
Martin Strambach on 25 Oct 2017
Answered: Ramtin Jafari on 2 Dec 2017
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?

  0 Comments

Sign in to comment.

Answers (1)

Ramtin Jafari
Ramtin Jafari on 2 Dec 2017
I have exactly the same issue!

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!