Borrar filtros
Borrar filtros

Exception reading response; Unrecognized SSL message, plaintext connection?

14 visualizaciones (últimos 30 días)
mail = 'email@company.com';
password = 'pwd@123';
setpref('Internet','SMTP_Server','email.company.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','587');
sendmail('yyy@company.com','Test from MATLAB','Hello! This is a test from MATLAB!')
sendmail('yyy222@gmail.com','Test from MATLAB','Hello! This is a test from MATLAB!')
After Executing the above program ,there is an exception caught:
??? Error using ==> sendmail at 168 Exception reading response; Unrecognized SSL message, plaintext connection?
Please Suggest what changes i need to do for sending email through SSL?

Respuestas (1)

SuperNano
SuperNano el 5 de Nov. de 2015
Might be a bit of a late answer for you, but I just got through resolving a similar issue. If your company's smtp server is using port 587, it probably means it's using starttls, which is a plain text protocol with an upgrade to TLS. So if we tell matlab to use SSL, it doesn't understand the plain text responses. So need to omit the line props.setProperty('mail.smtp.socketFactory.class','javax.net.ssl.SSLSocketFactory'); or if you've already set it, use props.remove('mail.smtp.socketFactory.class'); to delete the key. Additionally you probably need to enable starttls with props.setProperty('mail.smtp.starttls.enable', 'true' );
This worked for me!
  2 comentarios
Richard Fiola
Richard Fiola el 15 de Mayo de 2018
Thank-you SuperNano! This solved the problem for me as well.
Mohanad Bahshwan
Mohanad Bahshwan el 31 de Jul. de 2020
You are a hero SuperNano! Fixed my problem!

Iniciar sesión para comentar.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by