Prev: Windows priorities with runtime.exec
Next: DIRECT CLIENT Opening: ITIM-TAM Analyst in Austin, TX.- 06+ months
From: Mike Amling on 8 Jun 2010 10:27 jesbox wrote: > private static void sendMail(final Email email) { > final String host = System.getProperty("smtp.gmail.com") != > null ? > System.getProperty("smtp.gmail.com") : ""; > ... > new Mailer(host, 25, username, password).sendMail(email); > } > } What value did you assign to system property smtp.gmail.com? The Mailer seems to be using "localhost". Did you specify -Dsmtp.gmail.com=localhost in the java command line? Or did the code invoke new Mailer("", ...)? > > The stacktrace is then becomes : > ERROR - Could not connect to SMTP host: localhost, port: 25 > javax.mail.MessagingException: Could not connect to SMTP host: > localhost, port: 25; > nested exception is: > java.net.ConnectException: Connection refused > at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java: > 1545) > at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java: > 453) > at javax.mail.Service.connect(Service.java:313) > at javax.mail.Service.connect(Service.java:172) > at javax.mail.Service.connect(Service.java:121) > at javax.mail.Transport.send0(Transport.java:190) > at javax.mail.Transport.send(Transport.java:120) > at org.codemonkey.vesijama.Mailer.sendMail(Mailer.java:174) > at TestMail.sendMail(TestMail.java:56) > at TestMail.testMail(TestMail.java:47) > at TestMail.main(TestMail.java:33) > Caused by: java.net.ConnectException: Connection refused > at java.net.PlainSocketImpl.socketConnect(Native Method) > at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) > at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java: > 195) --Mike Amling
From: jesbox on 8 Jun 2010 18:58 Thanks for the tips. I have changed into hard-coded values, i.e. System.setProperty("mail.smtps.auth", "true"); // enable https new Mailer("smtp.gmail.com", 465, "myEmail(a)gmail.com", "a_password").sendMail(email); The exception I get is: org.codemonkey.vesijama.MailException: Generic error: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1 at org.codemonkey.vesijama.Mailer.sendMail(Mailer.java:180) at TestMail.sendMail(TestMail.java:57) at TestMail.testMail(TestMail.java:52) at TestMail.main(TestMail.java:33) Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java: 1533) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java: 453) at javax.mail.Service.connect(Service.java:313) at javax.mail.Service.connect(Service.java:172)
From: Arne Vajhøj on 8 Jun 2010 19:30 On 08-06-2010 18:58, jesbox wrote: > Thanks for the tips. I have changed into hard-coded values, i.e. > System.setProperty("mail.smtps.auth", "true"); // enable https Not so relevant for your problem but you are using SMTP over SSL where HTTPS is HTTP over SSL. Arne
From: jesbox on 9 Jun 2010 04:23 On Jun 9, 1:30 am, Arne Vajhøj <a...(a)vajhoej.dk> wrote: > On 08-06-2010 18:58, jesbox wrote: > > > Thanks for the tips. I have changed into hard-coded values, i.e. > > System.setProperty("mail.smtps.auth", "true"); // enable https > > Not so relevant for your problem but you are using > SMTP over SSL where HTTPS is HTTP over SSL. > > Arne Right, I try to run SMTP over SSL. And, as you suggest, that insight does not bring me forward. Thanks for the enlightment anyway.
From: Paul Cager on 9 Jun 2010 06:48 On Jun 8, 11:58 pm, jesbox <jesb...(a)gmail.com> wrote: > Thanks for the tips. I have changed into hard-coded values, i.e. > System.setProperty("mail.smtps.auth", "true"); // enable https > new Mailer("smtp.gmail.com", 465, "myEm...(a)gmail.com", > "a_password").sendMail(email); Sorry if this is a silly question, but are the username and password above just dummies because you (wisely) don't want to publish your real user/password on usenet? You _are_ passing in your own real Gmail user-id and password when you run your program?
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Windows priorities with runtime.exec Next: DIRECT CLIENT Opening: ITIM-TAM Analyst in Austin, TX.- 06+ months |