Re: Unable to send email from local server
- From: "Greg R. Broderick" <usenet200704@xxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 24 Apr 2007 01:57:09 -0500
mighty.tornado@xxxxxxxxx wrote in news:1177379020.756857.185980
@l77g2000hsb.googlegroups.com:
Hi,
I set up a small web app and would like to send email, so I am using
google's smtp server. But I get an exception back. Here it is:
[snippage]
Caused by: javax.mail.MessagingException: Could not connect to SMTP
host: smtp.g
mail.com, port: 465, response: -1
at
com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1270)
at
com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:37
0)
at javax.mail.Service.connect(Service.java:297)
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 org.apache.commons.mail.Email.sendMimeMessage(Email.java:
863)
... 19 more
What am I doing wrong?
The mail client software (your app) was unable to connect to the mail server
"smtp.gmail.com" on port 465, as the exception message stated. This could be
for any number of reasons, including:
- you have a firewall blocking your host from connecting to a remote host on
port 465.
- gmail's mail server is down and temporarily unreachable
- a router somewhere between your host and smtp.gmail.com is malfunctioning
and preventing a connection
- you aren't using SSL/TLS in your connection to smtp.gmail.com, as is
required, per <http://mail.google.com/support/bin/answer.py?answer=13287
&topic=1556>.
using telnet to connect to the remote host will allow you to determine if the
problem lies within your code (i.e. telnet is able to connect) or outside of
your code (i.e. telnet is also unable to connect). If the problem can be
localized to your code, then JavaMail has a debugging trace option that is
enabled by setting a system property named "mail.debug" to "true" (String
value). This will cause a full transcript of your session with the mail
server to be output to the console, and is quite useful in diagnosing issues
such as this.
In any case, this is something that your code should anticipate and handle
gracefully - your code is dependent upon a resource (the mail server) that is
outside of your control, therefore your code MUST handle this resource being
unavailable, either permanently or temporarily, gracefully.
Cheers!
--
---------------------------------------------------------------------
Greg R. Broderick usenet200704@xxxxxxxxxxxxxxxxxxxxx
A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
.
- Follow-Ups:
- Re: Unable to send email from local server
- From: Roman
- Re: Unable to send email from local server
- References:
- Unable to send email from local server
- From: mighty . tornado
- Unable to send email from local server
- Prev by Date: Threading in web Application
- Next by Date: Re: Server and multiple sockets
- Previous by thread: Re: Unable to send email from local server
- Next by thread: Re: Unable to send email from local server
- Index(es):
Relevant Pages
|