in reply to Re: Sending two messages thru an smtp server with authentication
in thread Sending two messages thru an smtp server with authentication

The problem is that the messages aren't sent out constantly in the real app. It could be five hours between each send, so the SMTP server would boot me by then.
milkbone - perl/tk instant messaging - it's the only way to fly

You know anyone who'll debug two million lines of code for what I get this job?
- Dennis Nedry

  • Comment on Re: Re: Sending two messages thru an smtp server with authentication

Replies are listed 'Best First'.
Re: Re: Re: Sending two messages thru an smtp server with authentication
by Mr. Muskrat (Canon) on Jul 11, 2003 at 16:54 UTC
    So what happens if you put a sleep statement at the end of the loop? Something like:
    #!/usr/bin/perl use Net::SMTP; use strict; use warnings; for(1..2) { my $smtp = Net::SMTP->new('smtpauth.earthlink.net', Hello => 'milkbone.org', Debug => 1) or die +"death"; $smtp->auth('batkins86@earthlink.net', '***************************' +); $smtp->mail('monitor@milkbone.org'); $smtp->to('test@batkins.com'); $smtp->data(); $smtp->datasend("To: postmaster\n"); $smtp->datasend("\n"); $smtp->datasend("A simple test message\n"); $smtp->dataend(); $smtp->quit; sleep(5); }

    Perhaps Net::SMTP hasn't fully cleaned up before you call it again? Don't think it would matter but I'm trying to cover all the bases...