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.
Send email via MATLAB
12 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Web Services 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!