• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1889
  • Last Modified:

smtp with hotmail

  I'm developing an smtp client in 100% base java. (ie no java mail stuff used) Right now it works with only some smtp servers.  
   It must however, work with hotmail since many people use hotmail.  When the clients hits hotmail the connection nevers opens right.  Here is my test code:


import java.net.*;
import java.io.*;
import java.util.*;

public class Test
{
   public static void main(String[] args)
   {      
        DataInputStream reply = null;
        PrintStream send = null;
        Socket sock = null;
      String rstr = null;

        try
        {
System.out.println("try to connect");
           sock = new Socket( "hotmail.com", 25 );
System.out.println("conected");
           reply = new DataInputStream( sock.getInputStream() );
System.out.println("got a data input stream - try output stream");
           send = new PrintStream( sock.getOutputStream() );
System.out.println("got a data output stream - try reading stream");
           rstr = reply.readLine();
System.out.println("read: " + rstr);
        }
      catch (UnknownHostException x1)
      {
         System.out.println("Failed to find host - hotmail.com");
         System.out.println(x1.getMessage());
      }
      catch (IOException x3)
      {
         System.out.println("Error reading / writing to socket on hotmail.com");
         System.out.println(x3.getMessage());
      }

   }
}

running this I get:
try to connect
Error reading / writing to socket on hotmail.com
connect

   So right now I know the line:

   sock = new Socket( "hotmail.com", 25 );

never does return since the println after it does not appear on the screen.

My question is why? and how can I fix this.


0
calvinrsmith
Asked:
calvinrsmith
  • 5
  • 4
  • 4
  • +3
1 Solution
 
Ravindra76Commented:

What is the exception message U have got??
0
 
Ravindra76Commented:

Oh!!!!. Sorry. Ignore my previous comment.

I think hotmail is not allowing to u to listen on that port.

It may be their security issue ( I think)

0
 
Ravindra76Commented:

replace listen  with connect in my previous comment..
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
heyhey_Commented:
Hotmail gives you HTML interface to your e-mail account, but it DOES NOT SUPPORT SMTP.
0
 
gadioCommented:
The reason that many companies (including hotmail) will not let you use SMTP protocol is porbably because of SPAM mail (unsolicited mail) that would be sent through them. You, of cause, are not going to do that.... If you want to send mail, use your company's mail server or any other server of a company that knows you and trusts you. When you have such a server you can send email to anyone (as well as to people that have a hotmail account).
0
 
calvinrsmithAuthor Commented:
  When mail is sent to a company's email server, then the company email server must forward it to hotmail, right?  
   This must true or no mail ever arrives to hotmail users.  
   So, how does the company's email server send the mail to hotmail if not by smtp?
0
 
heyhey_Commented:
SMTP messages are (probably) handled from mail.hotmail.com or some other  server (hint 'DNS RFC')
0
 
gadioCommented:
As far as I remember, there is a different protocol for messages exchange between email servers, and its not SMTP.
0
 
calvinrsmithAuthor Commented:
anyone know what it is?
0
 
calvinrsmithAuthor Commented:
side note - port 25 gives me: connect
other ports give me: Operation times out
so there is something diferent with port 25 - the smtp port
0
 
daittCommented:
The server is "mail.hotmail.com" port 25, not "hotmail.com". The protocol is ESMTP (Extended SMTP). Initially defined in RFC 1869 and extended thereafter.
daitt
0
 
calvinrsmithAuthor Commented:
daitt: I modified my original program, listed above, to use mail.hotmail.com - port 25, and am getting the same results.
0
 
daittCommented:
Some extension: RFC 1651, RFC 1652, RFC 1653:

http://slug.ctv.es/mirror/rfc/16xx/
http://www.tac.nyc.ny.us/mail/rfc-index.html

I only know that ESMTP provides some notification features and the first command sent from the client is EHLO, not HELO.
Good luck
daitt

0
 
daittCommented:
You can check your internet connection .. I think the command is :
telnet mail.hotmail.com 25
It will open a connection to mail.hotmail.com port 25.
0
 
heyhey_Commented:
telnet mail.hotmail.com 25
does not work for me too.


0
 
daittCommented:
It means you cannot connect to mail.hotmail.com port 25. Telnet opens a raw connection and simply echo what it received and send what you typed. I connected to mail.hotmail.com port 25 and the result was:

220-HotMail (NO UCE) ESMTP server ready at Mon Feb 21 01:10:26 2000
220 ESMTP spoken here

Then I tried to type the command HELO 127.0.0.1 1234 and the result was:

250 Requested mail action okay, completed

I think SMTP was working on the host. So if you couldn't connect to mail.hotmail.com port 25, you can contact your network administrator.
0
 
vladi21Commented:
also they use or have used
Protocol: HTTPMail
Server: http://services.msn.com/svcs/hotmail/httpmail.asp
....
0
 
calvinrsmithAuthor Commented:
vladi21, can you explain how that link works?  when i load it it asks me to loginm which I do, then it displays:

Internal Server Error
Oops! The server encountered an internal error and was unable to complete your request.
Please contact our server administrators and inform them of the time the error occurred and what activity you might have been performing just prior to receiving this error.


I assume this is because no paramters are passed to the web site.

0
 
heyhey_Commented:
mail.hotmail.com:25 is working as SMTP server now :)
0
 
Ravindra76Commented:
what a explosion by heyhey!!!

:) :) :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 5
  • 4
  • 4
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now