commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy <guy.van.tilbo...@gmail.com>
Subject Re: email1-0 exception reading response: java.net.SocketException: Connection reset
Date Thu, 14 Jun 2007 12:57:24 GMT
Thanks for the reply!

do you happen to have code that actually does this? Like i said, i am
new to javaMail and i am having difficulty setting up the SSL.

It would be much appreciated

Guy

On 6/14/07, Fred Janon <fjanon@gmail.com> wrote:
> I had the same issue a couple of months ago. The Commons-Mail library
> doesn't seem to support SSL and it's needed to connect to Google or Yahoo
> SMTP mail. I had to call the javax.mail library directly, it turned out not
> that difficult.
>
> Fred
>
> On 6/14/07, Guy <guy.van.tilborgh@gmail.com> wrote:
> >
> > ---------- Forwarded message ----------
> > From: Guy <guy.van.tilborgh@gmail.com>
> > Date: Jun 14, 2007 11:16 AM
> > Subject: email1-0 exception reading response:
> > java.net.SocketException: Connection reset
> > To: commons-user-digest@jakarta.apache.org
> >
> >
> > Hi,
> >
> > i admit, i am new to the commons-mail project and this is a newbie
> > question, i am totally aware of it:
> >
> > i am trying to send a simple email using googles SMTP server, but i
> > keep on getting "exception reading response: java.net.SocketException:
> > Connection reset" errors.
> >
> > This is my code which is straightforward (the To address and password
> > are replaced of cource):
> >
> >        try
> >        {
> >            SimpleEmail email = new SimpleEmail();
> >
> >            email.setHostName("smtp.gmail.com");
> >            email.setSmtpPort(465);
> >            email.addTo("recipient@yahoo.com", "recipientname");
> >            email.setFrom("guy.van.tilborgh@gmail.com", "myname");
> >            email.setSubject("Test message");
> >            email.setMsg("This is a simple test of commons-email");
> >            email.setDebug(true);
> >            email.setAuthentication("guy.van.tilborgh@gmail.com","mypwd");
> >            email.send();
> >        }
> >        catch (Exception e)
> >        {
> >           e.printStackTrace();
> >        }
> >
> > This is the console output:
> >
> > BEGIN Thu Jun 14 09:03:16 CEST 2007
> > DEBUG: JavaMail version 1.4ea
> > DEBUG: java.io.FileNotFoundException: C:\Program
> > Files\Java\jdk1.5.0_07\jre\lib\javamail.providers (The system cannot
> > find the file specified)
> > DEBUG: URL
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/imap.jar!/META-INF/javamail.providers
> > DEBUG: successfully loaded resource:
> >
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/imap.jar!/META-INF/javamail.providers
> > DEBUG: URL
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/pop3.jar!/META-INF/javamail.providers
> > DEBUG: successfully loaded resource:
> >
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/pop3.jar!/META-INF/javamail.providers
> > DEBUG: URL
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/smtp.jar!/META-INF/javamail.providers
> > DEBUG: successfully loaded resource:
> >
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/smtp.jar!/META-INF/javamail.providers
> > DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
> > DEBUG: Tables of loaded providers
> > DEBUG: Providers Listed By Class Name:
> > {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,
> > com.sun.mail.smtp.SMTPSSLTransport,Sun
> > Microsystems, Inc],
> > com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,
> > com.sun.mail.smtp.SMTPTransport,Sun
> > Microsystems, Inc],
> > com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,
> > com.sun.mail.imap.IMAPSSLStore,Sun
> > Microsystems, Inc],
> > com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,
> > com.sun.mail.pop3.POP3SSLStore,Sun
> > Microsystems, Inc],
> > com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,
> > com.sun.mail.imap.IMAPStore,Sun
> > Microsystems, Inc],
> > com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,
> > com.sun.mail.pop3.POP3Store,Sun
> > Microsystems, Inc]}
> > DEBUG: Providers Listed By Protocol:
> > {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun
> > Microsystems, Inc],
> > imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
> > Microsystems, Inc],
> > smtps=javax.mail.Provider[TRANSPORT,smtps,
> > com.sun.mail.smtp.SMTPSSLTransport,Sun
> > Microsystems, Inc],
> > pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
> > Microsy stems, Inc],
> > smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport
> > ,Sun
> > Microsystems, Inc],
> > pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun
> > Microsystems, Inc]}
> > DEBUG: successfully loaded resource:
> > /META-INF/javamail.default.address.map
> > DEBUG: URL
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/smtp.jar!/META-INF/javamail.address.map
> > DEBUG: successfully loaded resource:
> >
> > jar:file:/D:/MyDoc/develop/Test/Mail/lib/smtp.jar!/META-INF/javamail.address.map
> > DEBUG: java.io.FileNotFoundException: C:\Program
> > Files\Java\jdk1.5.0_07\jre\lib\javamail.address.map (The system cannot
> > find the file specified)
> > DEBUG: getProvider() returning
> > javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
> > Microsystems, Inc]
> > DEBUG SMTP: useEhlo true, useAuth true
> > DEBUG SMTP: useEhlo true, useAuth true
> > DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL
> > false
> > DEBUG SMTP: exception reading response: java.net.SocketException:
> > Connection reset
> > END Thu Jun 14 09:14:46 CEST 2007
> > org.apache.commons.mail.EmailException: Sending the email to the
> > following server failed : smtp.gmail.com:465
> >        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:873)
> >        at org.apache.commons.mail.Email.send(Email.java:898)
> >        at TestMail.main(TestMail.java:26)
> > Caused by: javax.mail.MessagingException: Exception reading response;
> > nested exception is:
> >        java.net.SocketException: Connection reset
> >        at com.sun.mail.smtp.SMTPTransport.readServerResponse(
> > SMTPTransport.java:1462)
> >        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java
> > :1260)
> >        at com.sun.mail.smtp.SMTPTransport.protocolConnect(
> > SMTPTransport.java:370)
> >        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)
> >        ... 2 more
> > Caused by: java.net.SocketException: Connection reset
> >        at java.net.SocketInputStream.read(SocketInputStream.java:168)
> >        at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java
> > :97)
> >        at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> >        at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
> >        at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java
> > :75)
> >        at com.sun.mail.smtp.SMTPTransport.readServerResponse(
> > SMTPTransport.java:1440)
> >        ... 10 more
> >
> >
> > Thanks in advance
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message