http://www.perlmonks.org?node_id=39873

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question: (programs and processes)

Question: How can I Bcc, Cc or send mail to multiple recipients using the following code. use Net::SMTP; # Send the message and disconnect $smtp=Net::SMTP->new('$host'); $smtp->mail($from); $smtp->recipient($to); $smtp->data("Subject: $subject\r\n$body"); $smtp->quit; -thanks-

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: Using Net::SMTP to Bcc, Cc or multiple recipients
by Anonymous Monk on Apr 15, 2001 at 04:59 UTC
    Try sending the multiple recipients as an array. Such as: @to = ('first@yahoo.com', 'second@server.com'); $smtp->recipient(@to); It worked for me :)
      the answer is fine,its works
        all you need to do is following in @to have an array fo reciepients and then foreach (@to) { $smtp->datasend("To: $_\n"); }
      Does not work for me!
Re: Using Net::SMTP to Bcc, Cc or multiple recipients
by Fastolfe (Vicar) on Nov 04, 2000 at 01:19 UTC
    From the Net::SMTP documentation:
    recipient ( ADDRESS [, ADDRESS [ ...]] [, OPTIONS ] ) Notify the server that the current message should be sent to all of the addresses given. Each address is sent as a separate command to the server.
Re: Using Net::SMTP to Bcc, Cc or multiple recipients
by Fastolfe (Vicar) on Nov 04, 2000 at 01:17 UTC
    From the Net::SMTP documentation:
    recipient ( ADDRESS [, ADDRESS [ ...]] [, OPTIONS ] )<p> Notify the server that the current message should be sent to all of th +e addresses given. Each address is sent as a separate command to the +server.

    Originally posted as a Categorized Answer.

Re: Using Net::SMTP to Bcc, Cc or multiple recipients
by strredwolf (Chaplain) on Nov 04, 2000 at 07:46 UTC
    Only if you have proof that the recipients confirmed their request can you use Net::SMTP with no fear of loosing your ISP's account.

    Originally posted as a Categorized Answer.

Re: Using Net::SMTP to Bcc, Cc or multiple recipients
by Anonymous Monk on Aug 02, 2004 at 20:23 UTC
    anyád
Re: Using Net::SMTP to Bcc, Cc or multiple recipients
by Fastolfe (Vicar) on Nov 04, 2000 at 01:21 UTC
    From the Net::SMTP documentation:
    recipient ( ADDRESS [, ADDRESS [ ...]] [, OPTIONS ] ) Notify the server that the current message should be sent to all of the addresses given. Each address is sent as a separate command to the server.

    Originally posted as a Categorized Answer.