Solved

smtp with hotmail

Posted on 2000-02-19
20
1,863 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countAbc challenge 9 49
parentbit challenge 3 52
Eclipse Neon and jdk 1.8.0 11 69
micro services vs rest web services 16 50
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now