in reply to Re^3: Just can sent only ONE mail every time.
in thread Just can sent only ONE mail every time.

Fixed! Thanks everybody.
I only add a sub "over" and comment the sub "quit" in sendMail :
sub over { $self = @_; $self->{SMTP}->quit;

Then i add the sub in end of my

... use MySMTP; $mail = new MySMTP(); my @lists = $mail->get_list(); for my $addr (@list) { $mail->sendMail($addr,"how are you"); } $mail->over(); ## Add here

Replies are listed 'Best First'.
Re^5: Just can sent only ONE mail every time.
by WalkingZero (Sexton) on Aug 28, 2007 at 04:19 UTC
    As an afterthought, since you already fixed it. Here's a peice of advice that may or may not work for you. I am currently working with SMTP for work with a postfix mta system. you may want to consider using threads and Thread::Queue. then you queue up your messages, create a pre-defined number of threads and just have them pull from the queue then join when they are done. Very fast very efficient.

    "One future, two choices. Oppose them or let them destroy us" - Propaghandi
      Thank your reminder.I will try it in the future.Can you show some snippet of code how to finish the idea by Thread::Queue.

      BTW,I am also manage our Postfix MTA,just a jackaroo:)