Re: send SMTP email using socket problem: java.net.ConnectException

From: Steve Horsley (shoot_at_the.moon)
Date: 02/21/05


Date: Mon, 21 Feb 2005 18:18:09 +0000

jrefactors@hotmail.com wrote:
> I want to write the socket program to send SMTP email, without using
> any JavaMail API.
> Here's the program, but it turns out it has the following exceptions: I
> don't know
> which part it went wrong. please advise. thanks!!
>
> /**
> java.net.ConnectException: Connection timed out: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
> at java.net.Socket.connect(Socket.java:452)
> at java.net.Socket.connect(Socket.java:402)
> at java.net.Socket.<init>(Socket.java:309)
> at java.net.Socket.<init>(Socket.java:124)
> at SMTPTest.sendMail(SMTPTest.java:20)
> at SMTPTest.main(SMTPTest.java:12)
> */
>
> ======================================================================
> import java.net.*;
> import java.io.*;
> import java.util.*;
>
> /**
> * send SMTP email using socket
> *
> */
> public class SMTPTest
> { public static void main(String[] args)
> { SMTPTest smtp = new SMTPTest();
> smtp.sendMail();
> }
>
> public void sendMail()
> {
> try
> {
> Socket s = new Socket("smtp.gmail.com", 465); //smtp.gmail.com, 465

I don't think gmail allow you to send mail messages through their server using
SMTP at all. They allow POP3 to retrieve messages though.

You can prove by hand that they don't accept SMTP with this command:
    telnet smtp.google.com 465

Steve



Relevant Pages

  • Re: send SMTP email using socket problem: java.net.ConnectException
    ... > I want to write the socket program to send SMTP email, ... > public class SMTPTest ... I don't think gmail allow you to send mail messages through their server using ... SMTP at all. ...
    (comp.lang.java.programmer)
  • Re: Send email from MVS cobol
    ... If email sent from the mainframe is not time-critical (i.e., ... all arrived at the SMTP server in one huge spool file. ... As I pointed out in other postings, while the SMTP server "digests" a large ... For a spool file with, let's say, 3000 mail messages, this took up to 8 ...
    (bit.listserv.ibm-main)
  • Re: Send email from MVS cobol
    ... I did not know that SMTP was so single-minded! ... When I joined up, the shop's biggest problem were those mass emails, as they ... all arrived at the SMTP server in one huge spool file. ... For a spool file with, let's say, 3000 mail messages, this took up to 8 ...
    (bit.listserv.ibm-main)
  • Re: Spam in Exchange server
    ... > I was troubleshooting a problem on my SBS2K server where I am receiving an> enormous amount of messages in the badmail folder. ... I followed the steps to clean up the smtp queues> (however, the only way I could get the Small Business SMTP Connector to> stabilize was by clearing the check box for Anonymous access on the> Authentication page of the Default SMTP Virtual Server Properties. ... > Selecting the Anonymous access check box restored the users' ability to> receive mail, but also brought back the bad mail messages and the numerous> queues. ...
    (microsoft.public.backoffice.smallbiz2000)
  • Spam in Exchange server
    ... enormous amount of messages in the badmail folder. ... When I checked the Default SMTP virtual server's ... This stopped the bad mail messages and the SMTP queues, ...
    (microsoft.public.backoffice.smallbiz2000)