Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

smtp with hotmail

Posted on 2000-02-19
20
1,871 Views
Last Modified: 2012-06-27
  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
Comment
Question by:calvinrsmith
  • 5
  • 4
  • 4
  • +3
20 Comments
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2539455

What is the exception message U have got??
0
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2539457

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
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2539458

replace listen  with connect in my previous comment..
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 16

Expert Comment

by:heyhey_
ID: 2539629
Hotmail gives you HTML interface to your e-mail account, but it DOES NOT SUPPORT SMTP.
0
 
LVL 6

Expert Comment

by:gadio
ID: 2539716
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
 
LVL 1

Author Comment

by:calvinrsmith
ID: 2539906
  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
 
LVL 16

Expert Comment

by:heyhey_
ID: 2539923
SMTP messages are (probably) handled from mail.hotmail.com or some other  server (hint 'DNS RFC')
0
 
LVL 6

Expert Comment

by:gadio
ID: 2539943
As far as I remember, there is a different protocol for messages exchange between email servers, and its not SMTP.
0
 
LVL 1

Author Comment

by:calvinrsmith
ID: 2539959
anyone know what it is?
0
 
LVL 1

Author Comment

by:calvinrsmith
ID: 2540104
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
 
LVL 3

Expert Comment

by:daitt
ID: 2540987
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
 
LVL 1

Author Comment

by:calvinrsmith
ID: 2541002
daitt: I modified my original program, listed above, to use mail.hotmail.com - port 25, and am getting the same results.
0
 
LVL 3

Expert Comment

by:daitt
ID: 2541012
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
 
LVL 3

Expert Comment

by:daitt
ID: 2541031
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 2541522
telnet mail.hotmail.com 25
does not work for me too.


0
 
LVL 3

Accepted Solution

by:
daitt earned 150 total points
ID: 2541696
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
 
LVL 7

Expert Comment

by:vladi21
ID: 2541843
also they use or have used
Protocol: HTTPMail
Server: http://services.msn.com/svcs/hotmail/httpmail.asp
....
0
 
LVL 1

Author Comment

by:calvinrsmith
ID: 2571461
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 2571876
mail.hotmail.com:25 is working as SMTP server now :)
0
 
LVL 7

Expert Comment

by:Ravindra76
ID: 2572914
what a explosion by heyhey!!!

:) :) :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question