Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Just can sent only ONE mail every time.

by ikegami (Patriarch)
on Aug 28, 2007 at 03:33 UTC ( [id://635484]=note: print w/replies, xml ) Need Help??


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

Did you check if SMTP (or the version on which Net::SMTP is based) can send more than one message per connection? Even HTTP wasn't able to do so originally. At a glance, it doesn't look like SMTP can either.
  • Comment on Re^3: Just can sent only ONE mail every time.

Replies are listed 'Best First'.
Re^4: Just can sent only ONE mail every time.
by pysome (Scribe) on Aug 28, 2007 at 04:05 UTC
    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 a.pl

    ... use MySMTP; $mail = new MySMTP(); my @lists = $mail->get_list(); for my $addr (@list) { $mail->sendMail($addr,"how are you"); } $mail->over(); ## Add here
      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:)
        Regards,
        -pysome

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://635484]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (9)
As of 2024-04-16 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found