File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes springframework.mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "springframework.mail" Watch "springframework.mail" New topic
Author

springframework.mail

Poonam Kadu
Ranch Hand

Joined: Jul 21, 2006
Posts: 49
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: springframework.mail
 
Similar Threads
how to send mail using gmail server
SMTP(Simple Mail Transer Protocol)
Unknown SMTP host for gmail
Enable Mailing services
Send Mail-Exception