Hi Anandha,
The error message you are encountering suggests an issue with the security protocol used by MATLAB to establish a connection with your SMTP server. This can occur due to a mismatch between the security requirements of the SMTP server and the capabilities/configuration of the MATLAB environment.
Ensure that your network or firewall settings are not blocking the connection to the SMTP server. Some institutions have strict network policies that might block certain outbound connections.
You can try using a different email service (e.g., Gmail's SMTP server) with its corresponding settings as follows:
mail = 'sender_address@gmail.com'; % Your Gmail address
password = 'sender_password'; % Your Gmail password
mailingList = {'receiver_address@gmail.com'}; % Recipient's email address
server = 'smtp.gmail.com'; % Gmail's SMTP server
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.port','587'); % Use 465 for SSL
props.setProperty('mail.smtp.auth','true'); % Enable authentication
props.setProperty('mail.smtp.starttls.enable','true'); % Enable STARTTLS
props.setProperty('mail.smtp.ssl.trust', 'smtp.gmail.com'); % Trust the Gmail SMTP server
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Server',server);
setpref('Internet','SMTP_Username',mail);
setpref('Internet','SMTP_Password',password);
messageBody = sprintf('Good morning');
messageBody = sprintf('%s\n\nHere is the data analysis from yesterday''s data. Have a great day!', messageBody);
messageBody = sprintf('%s\n\n\n*This email was generated and sent automatically via MATLAB', messageBody);
% Assuming 'filename' is defined elsewhere in your script
sendmail(mailingList, "Data Analysis", messageBody, filename);
If you have 2-Step Verification enabled on your Google account (which is highly recommended for security reasons), you cannot use your regular password. Instead, you will need to generate an App Password specifically for use in your MATLAB script.
You can try to directly access the App Passwords page by using this URL: https://security.google.com/settings/security/apppasswords
Generate a 16 character password and use it instead of your regular password in the code above. It should work.