I am trying to build a script to send automatic emails; see the code below. I receive two types of errors.

6 views (last 30 days)
I am trying to build a script to send automatic emails; see the code below. I receive two types of errors.
1) When I run it from my laptop @ work I receive the following error (the SMTP I typed is correct):
"Error using sendmail (line 164) Unknown SMTP host: smtp.mail.yahoo.com; smtp.mail.yahoo.com
Error in SendEmails (line 18) sendmail(mail,'Test from MATLAB','Hello! This is a test from MATLAB!')"
2) When I send it from another PC @ home, the error is:
"Error using sendmail (line 172) Exception reading response; sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Error in Untitled (line 17)
sendmail(mail,'Test from MATLAB','Hello! This is a test from MATLAB!') "
How can I fix this issue? BR, Vittorio
password = ''; %Your Yahoo password
mail = 'vittorio.manente@yahoo.com'; %Your Yahoo email address
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,'Test from MATLAB','Hello! This is a test from MATLAB!')

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!