CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
Smtp Clien problem


New User

Feb 2, 2003, 8:59 AM

Post #1 of 3 (714 views)
Smtp Clien problem Can't Post

I'm trying to write a small smtp client using IO:Socket.

The problem is that sometime I Can connect to the SMTP server to port 25 but it doesn't return any response, Then my clien is wauiting for ever trying to read from the soket. Any ideas how to solve it?

Code sample:

unless($mx = new IO::Socket::INET( PeerAddr => $remote,

PeerPort => 25,

Proto => 'tcp',

Timeout => 2)) {

return -1;


unless (<$mx> =~ m/^220/) { # here the script is stuck if the server don't sent answer

return -1;


print $mx "HELO D\r\n";

$f = <$mx>;

print $f;

unless ($f =~ m/^250/) {

return -1;




Thaumaturge / Moderator

Feb 3, 2003, 2:02 AM

Post #2 of 3 (706 views)
Re: [alto] Smtp Clien problem [In reply to] Can't Post

The best solution is probably not to use a low-level module like IO::Socket when Net::SMTP is available.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks

New User

Feb 3, 2003, 3:37 AM

Post #3 of 3 (703 views)
Re: [davorg] Smtp Clien problem [In reply to] Can't Post

Thanks for the replay, but I have to use a low level module cause I have to enter there non regular command that the SMTP module canít provide.

Anyway I found a way to solve it using the IO::Select module.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives