Unknown SMTP host exception...
Hi all...
am a newbie in j2ee...i have to send mails from my application...
have written the code...but it gives an error like the smtp host specified, is
unknown...
can anyone pleaz tell me what r the things to be set up or what r the configurations to be done to send a mail using program...am using Transport.send(message) function to do it...plz help me...
thanx and regards,
sand...
# 4
Hi,
As mentioned in the debugging steps, I turned the debugging session on by "session.setDebug(true);".I got the following printed on my console:
DEBUG: setDebug: JavaMail version 1.4ea
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
MessagingException
javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1280)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
at sendMail.main(sendMail.java:28)
Caused by: java.net.UnknownHostException: smtp.gmail.com
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 7 more
I also tried to use telnet to connect as
telnet smtp.gmail.com 25
Here I got an output like
Connecting To smtp.gmsil.com...Could not open connection to the host, on port 25
: Connect failed
so now I donot understand wher the problem lies actually.
Can you please suggest anything?
Thanks
# 8
m also gettin g the same error...
if neone can throw some light on it ..den it will of gr8 help !!
m workin on local dev environment and from here m trin to connect to the custiomer zone of ma client ofr a testing ...
but while submitting the form on the application site ...i got the following msgs on the ATG console ...
Exception while sending the mailcom.jnj.indp.site.common.exception.IndpException: Exception in sending e-mail, msg= Sending fai
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: smtp.na.jnj.com;
nested exception is:
java.net.UnknownHostException: smtp.na.jnj.com, javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: smtp.na.jnj.com;
nested exception is:
java.net.UnknownHostException: smtp.na.jnj.com
hw can it b rectified ?