how do you sendmail using tls 1.2 and 1.3

73 vues (au cours des 30 derniers jours)
Roar Rawr
Roar Rawr le 17 Juil 2022
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 commentaires
Andrew Janke
Andrew Janke le 28 Nov 2023
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?
Roar Rawr
Roar Rawr le 28 Nov 2023
I actually found the solution to this, the solution is actually not lies in the matlab code, it is the way matlab communicate with the email server, in my case, it was gmail that i needed to work on

Connectez-vous pour commenter.

Réponses (1)

Samay Sagar
Samay Sagar le 26 Sep 2024

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by