Problem with : Error using sendmail; Can't send command to SMTP host; Remote host closed connection during handshake
Show older comments
Hi I am trying to sendmail using the below, but i get :
Error using sendmail; Can't send command to SMTP host; Remote host closed connection during handshake
mail='#mail@mail';
password='#password';
server = '#smtp.server.com';
Subject = 'Test';
Text = 'Test';
setpref('Internet','E_mail', mail);
setpref('Internet','SMTP_Server', server);
setpref('Internet','SMTP_Username', mail);
setpref('Internet','SMTP_Password', password);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.port', '587');
props.setProperty('mail.smtp.starttls.enable','true');
sendmail('#mail@mail', Subject, Text)
Any ideas what the problem is and how to fix it?
Thank you
2 Comments
Amanda Fortuna
on 15 Apr 2024
Hi,
I'm having the same issue. Did you get this resolved? If so would you mind sharing the resolution please.
Thank you.
Rajanya
on 9 Aug 2024
Can you please specify the version of MATLAB that you are using and also the mail server you are trying to establish a connection on? I tried the same code as provided above using outlook smtp server on MATLAB R2024a and did not get any error.
Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!