Sendmail Error [EOF]

1 回表示 (過去 30 日間)
Zachary Reinke
Zachary Reinke 2017 年 9 月 3 日
コメント済み: Enzo De Sena 2017 年 11 月 19 日
I had been using the sendmail() function to send a notification once my program was finished. But now I keep getting this message.
Error using sendmail (line 169)
[EOF]
Error in send_text_message (line 86)
sendmail(emailto,subject,message)
This is the code:
mail ='-------@gmail.com'; % Your mail id
password ='-------'; % Your password
host = 'smtp.gmail.com';
port = '465';
emailto = '-------';
props = java.lang.System.getProperties;
props.setProperty( 'mail.smtp.user', mail );
props.setProperty( 'mail.smtp.host', host );
props.setProperty( 'mail.smtp.port', port );
props.setProperty( 'mail.smtp.starttls.enable', 'true' );
props.setProperty( 'mail.smtp.debug', 'true' );
props.setProperty( 'mail.smtp.auth', 'true' );
props.setProperty( 'mail.smtp.socketFactory.port', port );
props.setProperty( 'mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory' );
props.setProperty( 'mail.smtp.socketFactory.fallback', 'false' );
sendmail('emailto','Matlab-opt','test');
I can't figure out what is going on.
  1 件のコメント
Enzo De Sena
Enzo De Sena 2017 年 11 月 19 日
Same problem here..

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2017 年 9 月 3 日
Why is emailto not a valid email address? That might be the problem. The recipient can't be 'emailto'. It must be 'emailto@something.com'
You also gave 'emailto' as the recipient rather than emailto (not in single quotes) which would have send '------' to sendmail(). However neither of those is right. You need to do something like
emailto = 'zachary@whatever.com';
subject = 'Just a test message';
message = ver; % Get MATLAB toolboxes and license number.
sendmail(emailto, subject, message); % No single quotes around emailto.
  2 件のコメント
Zachary Reinke
Zachary Reinke 2017 年 9 月 3 日
編集済み: Zachary Reinke 2017 年 9 月 3 日
It is. I have a emailto variable defined in the first block of code. I just have the ----- to show thats where the address goes.
I just tried it again without single quotes and got the same error.
mail ='---@gmail.com'; % Your mail id
password ='---'; % Your password
host = 'smtp.gmail.com';
port = '465';
emailto = '---@vtext.com';
props = java.lang.System.getProperties;
props.setProperty( 'mail.smtp.user', mail );
props.setProperty( 'mail.smtp.host', host );
props.setProperty( 'mail.smtp.port', port );
props.setProperty( 'mail.smtp.starttls.enable', 'true' );
props.setProperty( 'mail.smtp.debug', 'true' );
props.setProperty( 'mail.smtp.auth', 'true' );
props.setProperty( 'mail.smtp.socketFactory.port', port );
props.setProperty( 'mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory' );
props.setProperty( 'mail.smtp.socketFactory.fallback', 'false' );
sendmail(emailto,'Matlab-opt','test');
Error using sendmail (line 169)
[EOF]
Error in Text_Me_Test (line 29)
sendmail(emailto,'Matlab-opt','test');
Thanks for the ideas!
Image Analyst
Image Analyst 2017 年 9 月 3 日
編集済み: Image Analyst 2017 年 9 月 3 日
Then I don't know. Maybe it's a firewall issue. It works for me in the attached demo. Call tech support and they'll figure it out for you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeWeb Services についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by