error with gmail sending
Mostra commenti meno recenti
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 Commento
Liang MA
il 13 Gen 2015
I have the same problem.
Risposte (1)
Shoaibur Rahman
il 27 Dic 2014
Modificato: Shoaibur Rahman
il 27 Dic 2014
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 Commenti
AA
il 27 Dic 2014
Shoaibur Rahman
il 27 Dic 2014
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
Categorie
Scopri di più su Web Services in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!