Unknown SMTP host: smtp.gmail.com; smtp.gmail.com
12 views (last 30 days)
Show older comments
HI, I'm from India.
I want to send message to a mobile to get others alert. The following code i have found from the matlab user community.
When I run the code, the error iam facing is
Unknown SMTP host: smtp.gmail.com;
smtp.gmail.com
addrs = 'username@gmail.com' ;
pwd = 'xxxxx' ;
setpref('Internet','E_mail',addrs) ;
setpref('Internet', 'SMTP_Server', 'smtp.gmail.com');
setpref('Internet', 'SMTP_Username', addrs);
setpref('Internet', 'SMTP_Password',pwd);
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.fallback','false') ;
props.setProperty('mail.smtp.socketFactory.port','465') ;
sendmail(addrs,'test','anil') ;
Please help me in resolving this error.
Thanks in advance for your help.
0 Comments
Answers (1)
Walter Roberson
on 6 Mar 2016
If you are using MS Windows, then use the Windows "Nslookup" command to explore whether your system can resolve the address of smtp.gmail.com . See https://technet.microsoft.com/en-us/library/cc725991.aspx
In particular, try
! nslookup -querytype=a smtp.google.com. ns3.google.com
If that succeeds then try also
! nslookup -querytype=a smtp.google.com.
which will give you a hint about whether your default nameserver is able to find the information. It is possible that somehow you have no nameserver configured or that the nameserver that you have configured is having problems reaching the appropriate name service. If you are connected to an internet provider it is common for your system to be configured to use DHCP that automatically configures a nameserver, but sometimes you need to configure your system according to static nameserver information provided by your internet company.
See Also
Categories
Find more on Web Services in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!