Send email via MATLAB

9 visualizzazioni (ultimi 30 giorni)
Pedro
Pedro il 22 Ott 2014
Risposto: Image Analyst il 22 Ott 2014
Hi, I need to send an email via MATLAB and I've read the instructions for sendmail and lots of answers around here. I've tried 3 email providers and I can't really use any of them:
- Gmail: I can only send email when I deactivate my anivirus
- Hotmail and Yahoo: Error using sendmail (line 171) Exception reading response; Connection reset
- Hotmail and Yahoo (antivirus off): Error using sendmail (line 171) Exception reading response; Unrecognized SSL message, plaintext connection?
__________________________________________________________________________
Here's the code
mail = 'user@service.com';
password = 'passwordgoeshere';
setpref('Internet','SMTP_Server','smtp.server.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',port);
sendmail(mail,'Test from MATLAB','Hello! This is a test from MATLAB!')
__________________________________________________________________________
I've used the following variables:
- Gmail: smtp.gmail.com port=465
- Hotmail: smtp.live.com port=465 and port=587
- Yahoo: smtp.mail.yahoo.com port=587
__________________________________________________________________________
Since deactivating the antivirus is not a good option, can anyone help me solving this?
Thank you

Risposte (1)

Image Analyst
Image Analyst il 22 Ott 2014
You may not be able to. I have one "lab" computer platform where I use one mail service where I can do it, but if I try to send via the standard company email using Outlook (our company email program), the Firewall prevents it and there's no combination of settings I can use to get around it. Web-based emails probably consider what you're doing as spamming and may have things in place to prevent it, regardless of your MATLAB settings.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by