Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Just can sent only ONE mail every time.

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


in reply to Just can sent only ONE mail every time.

quit ends the connection according to the docs. You probably have to create a new Net::SMTP object for every email. (Each email can have more than one recipient, though.)

Replies are listed 'Best First'.
Re^2: Just can sent only ONE mail every time.
by pysome (Scribe) on Aug 28, 2007 at 03:26 UTC
    Thanks. But if i put the new Net::SMTP in sub sendMail.It means every list will be connect the mail server once,it's so time-consuming.
    Do you some other method.Or how to organise the "order" ?Thanks again
      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.
        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

      Why not simply pass the list of addresses in and send the one email to multiple recipients using either TO or BCC addressing?


      DWIM is Perl's answer to Gödel

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found