error with gmail sending

조회 수: 1 (최근 30일)
AA
AA 2014년 12월 27일
댓글: Liang MA 2015년 1월 13일
Hi, I get the following error when wanting to send an email. Could anyone help me with this?
Error using sendmail1 (line 171) Could not connect to SMTP host: localhost, port: 25; Connection refused: connect
  댓글 수: 1
Liang MA
Liang MA 2015년 1월 13일
I have the same problem.

댓글을 달려면 로그인하십시오.

답변 (1개)

Shoaibur Rahman
Shoaibur Rahman 2014년 12월 27일
편집: Shoaibur Rahman 2014년 12월 27일
Make sure you are using some lines of code before using sendmail function:
UserName = 'yourmail@gmail.com';
passWord = 'password';
setpref('Internet','E_mail',UserName);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',UserName);
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','465');
emailto = 'emailWhereToSend'; % recipient's email
sendmail(emailto, 'My Subject', 'My message');
  댓글 수: 2
AA
AA 2014년 12월 27일
thanks. how can I send the variable x as attachment or its content?
Shoaibur Rahman
Shoaibur Rahman 2014년 12월 27일
save your variable, and add that as the fourth argument of the sendmail function. Examples in doc may help you too. http://www.mathworks.com/help/matlab/ref/sendmail.html

댓글을 달려면 로그인하십시오.

카테고리

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