how do you sendmail using tls 1.2 and 1.3
75 次查看(过去 30 天)
显示 更早的评论
Hi, this is my current send mail setting, but said they will not allow the usage of TLS 1.0 or TLS 1.1 anymore.
"For email connections between your devices or programs and our email servers to continue working after deactivation, they must support TLS 1.2 or higher."
So what do I need to do to switch to use TLS 1.2 or 1.3
setpref('Internet','SMTP_Server','smtp.ionos.com');
setpref('Internet','E_mail','myemail.com');
setpref('Internet','SMTP_Username','username');
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('txt,'txt)
2 个评论
Andrew Janke
2023-11-28
Hi all! Anyone found an answer with this? I haven't been able to get it working. I tried adding this:
props.setProperty('mail.smtp.starttls.enable', 'true');
props.setProperty('mail.smtp.ssl.protocols', 'TLSv1.2');
based on this SO discussion here, but no luck. With AWS SES, I'm still getting a "TLS 1.2 required" error like this:
Error using sendmail
554 Access denied: Amazon SES no longer supports TLS 1.0 and TLS 1.1 connections. You must update your client to use TLS version 1.2 or above. To learn more and to update your client, see https://go.aws/3AUlVSb. For further
assistance, contact AWS support
Looking at the Java JARs shipped with Matlab R2023b, seems like it's still bundling JavaMail 1.4 from 2006. One answer on that SO post says they needed to upgrade to JavaMail 1.5 or even 1.6 in addition to setting those properties. Maybe that's needed with Matlab, and could be done by putting a newer javax-mail JAR on the path ahead of the shipped JARs, or hacking the system classpath? Or maybe these properties need to be set earlier so they're present at library initialization time, and need to be done in a java.opts file instead of by calling props.setProperty() in M-code like done here?
回答(1 个)
Samay Sagar
2024-9-26
You can refer the following MATLAB Answer to use TLS 1.2 with the "sendmail" function : https://www.mathworks.com/matlabcentral/answers/2023422-problem-with-error-using-sendmail-can-t-send-command-to-smtp-host-remote-host-closed-connection#answer_1503984
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Web Services 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!