Effacer les filtres
Effacer les filtres

How do I use SENDMAIL to send email from a SMTP server that uses authorization in MATLAB 7.10 (R2010a)?

21 vues (au cours des 30 derniers jours)
I would like to send an email using a server that requires authorization. However, this server does not support SSL. How can I do this?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 30 Sep 2013
To send an email from a non-SSL SMTP server that requires authorization, please use the code below.
Make sure to substitute your actual email address, password, and SMTP server information in the first three lines of code. Contact your local technical support department to determine the address of your SMTP server.
mail = 'myemail@address.com; % Replace with your email address
password = 'l1ll1put'; % Replace with your email password
server = 'smtp.server.net'; % Replace with your SMTP server
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.port','587');
% Apply prefs and props
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Server',server);
setpref('Internet','SMTP_Username',mail);
setpref('Internet','SMTP_Password',password);
% Send the email
sendmail('receiver@email.com', 'Test', 'Msg from MATLAB');
Note that the above commands are undocumented and may change in future MATLAB releases, but they were last verified in MATLAB 8.2 (R2013b). Also, note that SENDMAIL does not support servers that require username and password authentications in MATLAB 7.1 (R14SP3) and before, and hence the above commands will not work with those releases.

Plus de réponses (0)

Tags

Aucun tag saisi pour le moment.

Produits


Version

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by