sending mail from gmail using sendmail()

44 ビュー (過去 30 日間)
Iddo Weiner
Iddo Weiner 2019 年 5 月 29 日
コメント済み: Adam Danz 2021 年 4 月 29 日
This code below used to work for me in the past (~2 years ago), but now it doesn't. Any ideas why?
Has something changed in Google's settings? Or in MATLAB?
I can tell you that my less secure apps are enabled on gmail - so that's not the problem.
Thanks, Iddo
% parameters
mail = ''; % my gmail address
password = 'myPassword'; % my gmail password
host = '';
sendto = '';
Subject = 'test subject';
Message = 'test message';
% preferences
setpref('Internet','SMTP_Server', host);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.socketFactory.class', '');
% execute
  7 件のコメント
Adam Danz
Adam Danz 2021 年 4 月 29 日
This appears to be a java based error. I can only suggest to go through the trouble shooting steps discussed in the comment section of the link I provided in my answer (open the link, read through the comments under the answer).
Common problems are
  • Not setting up gmail correctly
  • firewall
  • antivirus programs



Adam Danz
Adam Danz 2019 年 5 月 31 日
編集済み: Adam Danz 2019 年 6 月 1 日
Check for interference with your antivirus program(s) and firewalls. These are common problems (see comments in that link).

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by