Send email via MATLAB

조회 수: 9 (최근 30일)
Pedro
Pedro 2014년 10월 22일
답변: Image Analyst 2014년 10월 22일
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

답변 (1개)

Image Analyst
Image Analyst 2014년 10월 22일
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.

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by