Does anybody know why mx1.hotmail.com doesn't response correctly? Thanks

Discussion in 'Perl Misc' started by mike, Jun 11, 2007.

  1. mike

    mike Guest

    Hi Guys,

    In command line, I tried to connect and read responses from hotmail's
    smtp server, and get the ACK very fast, and correct. But, when I tried
    to do the same work with a script, the response to "helo" was very
    slow(30 seconds), and failed eventually. However, when I tried with
    gmail's smtp server(and some others), the script worked fine.
    Could anybody give me some hints what the problem is(please see
    attached content)?

    Thanks a lot.

    Mike

    -------------------------------------------------------------
    In command line:

    [testhost]$ telnet mx1.hotmail.com 25
    Trying 65.54.244.136...
    Connected to mx1.hotmail.com (65.54.244.136).
    Escape character is '^]'.
    220 bay0-mc3-f9.bay0.hotmail.com Sending unsolicited commercial or
    bulk e-mail to Microsoft's computer network is prohibited. Other
    restrictions are found at http://privacy.msn.com/Anti-spam/.
    Violations will result in use of equipment located in California and
    other states. Mon, 11 Jun 2007 12:59:17 -0700
    helo testeasy.com
    250 bay0-mc3-f9.bay0.hotmail.com (3.3.3.1) Hello [65.61.195.165]
    quit
    221 bay0-mc3-f9.bay0.hotmail.com Service closing transmission channel
    Connection closed by foreign host.
    [testhost]$

    -------------------------------------------------------------

    Run the test.pl with gmail's smtp server:

    [testhost]$ test.pl gsmtp183.google.com
    2007-05-11 13:01:24 << 220 mx.google.com ESMTP 34si1452943nfu
    2007-05-11 13:01:24 >> helo testeasy.com
    2007-05-11 13:01:24 waiting...
    2007-05-11 13:01:24 << 250 mx.google.com at your service
    2007-05-11 13:01:24 done
    [testhost]$

    -------------------------------------------------------------

    Run the test.pl with hotmail's smtp server:

    [testhost]$ test.pl mx1.hotmail.com
    2007-05-11 13:01:56 << 220 bay0-mc12-f16.bay0.hotmail.com Sending
    unsolicited commercial or bulk e-mail to Microsoft's computer network
    is prohibited. Other restrictions are found at http://privacy.msn.com/Anti-spam/.
    Violations will result in use of equipment located in California and
    other states. Mon, 11 Jun 2007 13:01:19 -0700
    2007-05-11 13:01:56 >> helo testeasy.com
    2007-05-11 13:01:56 waiting...
    2007-05-11 13:02:26 << NOTHING
    2007-05-11 13:02:26 done
    [testhost]$

    -------------------------------------------------------------

    Source code of test.pl

    #!/usr/bin/perl -w

    use strict;
    use IO::Socket;
    use Time::HiRes qw( usleep ualarm gettimeofday tv_interval );

    my ($string, $ret, $outstr);

    my $s = new IO::Socket::INET(PeerAddr=>$ARGV[0],
    PeerPort=> 25,
    Proto => 'tcp',
    Timeout => 10);
    die "Could not create socket: $!\n" unless $s;

    select($s);
    $|=1;
    select(STDOUT);

    $ret = $s->sysread( $string, 4096);
    &prtlog("<< $string");

    $string = "helo testeasy.com\n";
    $ret = $s->syswrite($string);
    if ($ret != length($string)) {
    prtlog("syswrite error. $ret\n");
    close($s);
    exit(0);
    }
    &prtlog(">> $string");

    $string = '';
    &prtlog("waiting...\n");

    $ret = $s->sysread( $string, 4096);
    if ($string eq '') {
    &prtlog("<< NOTHING\n");
    }
    else {
    &prtlog("<< $string");
    }

    close($s);

    prtlog("done\n");


    sub get_date()
    {
    my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov
    Dec);
    my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset,
    $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
    my $year = 1900 + $yearOffset;
    return sprintf("%d-%02d-%02d %02d:%02d:%02d", $year, $month,
    $dayOfMonth, $hour, $minute, $second);
    }

    sub prtlog {
    my $str = shift;

    print &get_date." $str";
    }
    mike, Jun 11, 2007
    #1
    1. Advertising

  2. >>>>> "mike" == mike <> writes:

    mike> In command line, I tried to connect and read responses from hotmail's
    mike> smtp server, and get the ACK very fast, and correct. But, when I tried
    mike> to do the same work with a script, the response to "helo" was very
    mike> slow(30 seconds), and failed eventually. However, when I tried with
    mike> gmail's smtp server(and some others), the script worked fine.
    mike> Could anybody give me some hints what the problem is(please see
    mike> attached content)?

    Why are you writing your own tool instead of using Net::SMTP or any of the
    higher-level libraries?

    And why do you care if the ACK is fast or slow?

    Unless you're a spammer... in which case... FOAD.

    print "Just another Perl hacker,"; # the original

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

    --
    Posted via a free Usenet account from http://www.teranews.com
    Randal L. Schwartz, Jun 11, 2007
    #2
    1. Advertising

  3. mike

    mike Guest

    On Jun 11, 2:21 pm, (Randal L. Schwartz) wrote:
    > >>>>> "mike" == mike <> writes:

    >
    > mike> In command line, I tried to connect and read responses from hotmail's
    > mike> smtp server, and get the ACK very fast, and correct. But, when I tried
    > mike> to do the same work with a script, the response to "helo" was very
    > mike> slow(30 seconds), and failed eventually. However, when I tried with
    > mike> gmail's smtp server(and some others), the script worked fine.
    > mike> Could anybody give me some hints what the problem is(please see
    > mike> attached content)?
    >
    > Why are you writing your own tool instead of using Net::SMTP or any of the
    > higher-level libraries?
    >
    > And why do you care if the ACK is fast or slow?
    >
    > Unless you're a spammer... in which case... FOAD.
    >
    > print "Just another Perl hacker,"; # the original
    >
    > --
    > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    > <> <URL:http://www.stonehenge.com/merlyn/>
    > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    >
    > --
    > Posted via a free Usenet account fromhttp://www.teranews.com


    Dude, I create the lower level code doesn't mean I am a hacker. Have
    you ever seen a hacker asked this such low lever questions? :)
    mike, Jun 12, 2007
    #3
  4. mike <> wrote:

    > #!/usr/bin/perl -w
    >
    > use strict;



    That should be:

    #!/usr/bin/perl

    use warnings;
    use strict;


    > &prtlog("<< $string");



    You should not use the ampersand on subroutine calls unless what
    it means is what you really want to do (and it seldom is).


    > prtlog("syswrite error. $ret\n");



    That's better.


    > &prtlog(">> $string");


    > &prtlog("waiting...\n");


    > &prtlog("<< NOTHING\n");


    > &prtlog("<< $string");



    Oops, slipped back to bad style.


    > prtlog("done\n");



    Followed by a return to good style.

    You should choose one style and stick with it.



    > my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov
    > Dec);



    You never use the @months array. So why is it there?


    > my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset,
    > $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
    > my $year = 1900 + $yearOffset;
    > return sprintf("%d-%02d-%02d %02d:%02d:%02d", $year, $month,
    > $dayOfMonth, $hour, $minute, $second);



    You got the year value right. :)

    You got the month value wrong. :-(


    > print &get_date." $str";



    print get_date() . " $str";


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad McClellan, Jun 12, 2007
    #4
  5. mike

    mike Guest

    On Jun 11, 2:21 pm, (Randal L. Schwartz) wrote:
    > >>>>> "mike" == mike <> writes:

    >
    > mike> In command line, I tried to connect and read responses from hotmail's
    > mike> smtp server, and get the ACK very fast, and correct. But, when I tried
    > mike> to do the same work with a script, the response to "helo" was very
    > mike> slow(30 seconds), and failed eventually. However, when I tried with
    > mike> gmail's smtp server(and some others), the script worked fine.
    > mike> Could anybody give me some hints what the problem is(please see
    > mike> attached content)?
    >
    > Why are you writing your own tool instead of using Net::SMTP or any of the
    > higher-level libraries?
    >
    > And why do you care if the ACK is fast or slow?
    >
    > Unless you're a spammer... in which case... FOAD.
    >
    > print "Just another Perl hacker,"; # the original
    >
    > --
    > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    > <> <URL:http://www.stonehenge.com/merlyn/>
    > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    >
    > --
    > Posted via a free Usenet account fromhttp://www.teranews.com


    Actually, I just found that hotmail.com sucks. Once I append "\r\n" to
    the end of the string, then everything worked fine.
    mike, Jun 12, 2007
    #5
  6. >>>>> "mike" == mike <> writes:

    mike> Actually, I just found that hotmail.com sucks. Once I append "\r\n" to
    mike> the end of the string, then everything worked fine.

    No, that means you "suck" as a programmer. The SMTP protocol officially
    requires \cM\cJ.

    This is why I said you shouldn't be writing this code from scratch!

    Sigh. Kids.

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

    --
    Posted via a free Usenet account from http://www.teranews.com
    Randal L. Schwartz, Jun 12, 2007
    #6
  7. mike

    mike Guest

    On Jun 11, 11:07 pm, (Randal L. Schwartz) wrote:
    > >>>>> "mike" == mike <> writes:

    >
    > mike> Actually, I just found that hotmail.com sucks. Once I append "\r\n" to
    > mike> the end of the string, then everything worked fine.
    >
    > No, that means you "suck" as a programmer. The SMTP protocol officially
    > requires \cM\cJ.
    >
    > This is why I said you shouldn't be writing this code from scratch!
    >
    > Sigh. Kids.
    >
    > --
    > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    > <> <URL:http://www.stonehenge.com/merlyn/>
    > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
    > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    >
    > --
    > Posted via a free Usenet account fromhttp://www.teranews.com


    Thanks for correcting,dude
    mike, Jun 12, 2007
    #7
  8. On Mon, 11 Jun 2007 16:17:55 -0700, mike <>
    wrote:

    >Dude, I create the lower level code doesn't mean I am a hacker. Have
    >you ever seen a hacker asked this such low lever questions? :)


    s/hacker/(qw<cracker spammer>)[rand 2]/ge;

    http://en.wikipedia.org/wiki/Hacker


    Michele
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
    Michele Dondi, Jun 14, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,747
    Smokey Grindel
    Dec 2, 2006
  2. Replies:
    1
    Views:
    383
  3. muelli75
    Replies:
    41
    Views:
    1,227
    cwdjrxyz
    Sep 1, 2010
  4. Dylan Parry
    Replies:
    1
    Views:
    376
  5. Paul D.Smith

    Hotmail popper - Hotmail => pop3 access <eom>

    Paul D.Smith, Oct 14, 2004, in forum: ASP General
    Replies:
    0
    Views:
    374
    Paul D.Smith
    Oct 14, 2004
Loading...

Share This Page