I was able to reproduce the issue with ‘sendmail()’ that you probably are facing. Maybe you could try adding the server details along with the mail address and password using ‘setpref(.)’.
Here’s how you can achieve it:
server = 'smtp-mail.outlook.com'; %(if you are using outlook)
setpref('Internet','SMTP_Server', server);
This should solve your issue in establishing a connection.
An alternative can also be to use TLS instead of SSL. TLS generally works on port 587 unlike SSL which works on 465. An example code could be like:
mail='your_mail_address';
password='your_password';
server = 'smtp-mail.outlook.com';
Subject = 'Some_subject';
Text = 'Some_text';
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('recipient_mail_address', Subject, Text)
Point to note: MATLAB’s ‘sendmail’ does not work with Gmail as it will be having authentication issues. You will need to “Allow less secure apps” in your account settings before setting up a connection on the Gmail server.
Feel free to reach out if you have any further queries regarding this.