通过MATLAB发送电子邮件 [英] Send email via MATLAB
问题描述
我需要通过MATLAB发送电子邮件,我已经阅读了关于sendmail的说明和大量的答案。我已经尝试过3个电子邮件提供商,我不能真正使用任何一个:
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:我只能发送电子邮件当我停用我的anivirus
Gmail: I can only send email when I deactivate my anivirus
Hotmail和Yahoo:使用sendmail错误(第171行)异常读取响应;连接重置
Hotmail and Yahoo: Error using sendmail (line 171) Exception reading response; Connection reset
Hotmail和Yahoo(防病毒关闭):使用sendmail错误(第171行)异常读取响应;无法识别的SSL消息,纯文本连接?
Hotmail and Yahoo (antivirus off): Error using sendmail (line 171) Exception reading response; Unrecognized SSL message, plaintext connection?
代码
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
Gmail: smtp.gmail.com port=465
Hotmail:smtp.live.com port = 465 and port = 587
Hotmail: smtp.live.com port=465 and port=587
Yahoo:smtp.mail.yahoo.com port = 587
Yahoo: smtp.mail.yahoo.com port=587
由于停用防病毒软件不是一个好选择,任何人都可以帮我解决这个问题吗?
Since deactivating the antivirus is not a good option, can anyone help me solving this?
谢谢
推荐答案
只需声明
mail = 'user';
删除扩展名 @ service.com 的变量邮件
。
这篇关于通过MATLAB发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!