in reply to Net:SMTP multiple sent to

From perldoc Net::SMTP

to ( ADDRESS [, ADDRESS [...]] )

So, I'm guessing you need to pass a list of Email IDs to to() or recipient()

--perlplexer

Replies are listed 'Best First'.
Re: Re: Net:SMTP multiple sent to
by minixman (Beadle) on May 01, 2003 at 16:16 UTC
    I have tried the option to put in
    $smtp->to('testme@hom.com, test2@home.com');
    that did not seem to work
      The Net::SMTP documentation says that won't work. Standard Perl lists (I think it can also take an array reference) are what is used for multiple addresses. to is a synonym for recipient so there isn't any need for using both or making multiple calls.
      $smtp->receipient($MailFrom1, $MailFrom2);
      Also, what is up with:
      my $MailFrom = 'postmaster\@testme.com'; my $MailTo1 = testmeuser@home.com};
      Did the code get mangled from posting because I don't think that will compile. In any case, the second string should be in single quotes. You don't need or wan't a backslash inside single quotes.
      my $MailFrom = 'postmaster@testme.com'; my $MailTo1 = 'testmeuser@home.com';

      Finally, should be checking the return codes of the calls. You don't know if the recipient call is failing because the mail server is rejecting the address or because the addresses are misformed.

      A list of emails. Not a single scalar with all emails separated by commas.
      my @emails = ('foo@var.com', 'bar@foo.com'); $smtp->to(@emails);
      --perlplexer