Hi Friends,
A couple of weeks back i written some code to send email using smtp.gmail.com .And it was working fine
But now when i executed the same code it throws the following exception :
Exception in
thread "main" org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:419)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:342)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:357)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346)
at com.mcs.mailer.SpringMailer.sendMail(SpringMailer.java:66)
at com.mcs.mailer.EmailCompTest.main(EmailCompTest.java:20)
Caused by: javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
I have set the following properties :
<property name="host" value="smtp.gmail.com"/>
<!-- smtp.mail.yahoo.com-->
<property name="port" value="587"/>
when i did nslookup i got this
>nslookup smtp.gmail.com
DNS request timed out.
timeout was 2 seconds.
*** Can't find server name for address 121.242.180.190: Timed out
DNS request timed out.
timeout was 2 seconds.
*** Can't find server name for address 121.242.180.211: Timed out
*** Default servers are not available
Server: UnKnown
Address: 121.242.180.190
DNS request timed out.
timeout was 2 seconds.
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out
What could be the possible problem?I mean is there something wrong with the 'smtp.gmail.com' or some network settings like firewall or something....
Please advice.
Cheers,
Poonam.