필터 지우기
필터 지우기

Exception reading response; Unrecognized SSL message, plaintext connection?

조회 수: 14 (최근 30일)
Padmanabham
Padmanabham 2014년 12월 14일
댓글: Mohanad Bahshwan 2020년 7월 31일
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?

답변 (1개)

SuperNano
SuperNano 2015년 11월 5일
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
Richard Fiola
Richard Fiola 2018년 5월 15일
Thank-you SuperNano! This solved the problem for me as well.
Mohanad Bahshwan
Mohanad Bahshwan 2020년 7월 31일
You are a hero SuperNano! Fixed my problem!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by