error with gmail sending

5 views (last 30 days)
AA on 27 Dec 2014
Commented: Liang MA on 13 Jan 2015
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 Comment
Liang MA
Liang MA on 13 Jan 2015
I have the same problem.

Sign in to comment.

Answers (1)

Shoaibur Rahman
Shoaibur Rahman on 27 Dec 2014
Edited: Shoaibur Rahman on 27 Dec 2014
Make sure you are using some lines of code before using sendmail function:
UserName = '';
passWord = 'password';
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.socketFactory.class', ...
emailto = 'emailWhereToSend'; % recipient's email
sendmail(emailto, 'My Subject', 'My message');
Shoaibur Rahman
Shoaibur Rahman on 27 Dec 2014
save your variable, and add that as the fourth argument of the sendmail function. Examples in doc may help you too.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!