我尝试在Matlab中通过Amazon SES发送电子邮件。它在2个月前运行良好,但现在它给出了以下java错误:
使用sendmail时出错(第164行)
异常阅读反应; sun.security.validator.ValidatorException:PKIX路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法找到要求的有效证书路径 目标
附上了matlab代码
myaddress = 'myemail@gmail.com';
username = 'xxxxxxxxxxxxxxxxxx';
mypassword = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
setpref('Internet','E_mail',myaddress);
setpref('Internet','SMTP_Server','email-smtp.us-east-1.amazonaws.com');
setpref('Internet','SMTP_Username',username);
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');
title = 'I am testing';
content = 'I am not sure if you can receive my email.';
email_address = 'targetemail@gmail.com';
sendmail(email_address, title, content);
答案 0 :(得分:2)
为自己找到答案。希望它能帮助其他可能遇到同样问题的人。 “关闭ANTI-VIRUS软件”,现在一切都很好。