tags:

views:

61

answers:

2

I want to be able to send email to multiple email addresses in:

my $email = Email::Simple->create(
    header => [
        To      => '"My Name" <[email protected]>',
        From    => '"Someone1" <[email protected]>',
        Subject => $subject,
    ],
    body => $body
);
sendmail($email, {transport => $transport});

Is it possible to write:

From => '"Someone1" <[email protected]>', '"Someone2" <[email protected]>'
+1  A: 

If you want send mail to multiple mail address the key is TO not FROM

So, you maybe will be using something like:

To => '[email protected];[email protected];[email protected];[email protected]'
Garis Suero
Beware of unintended interpolation of the array `@mail`. Use the single quotes `'`, `q{}` etc. to avoid this mistake!
daxim
Edited, thanks!
Garis Suero
i am getting error:
kamal
syntax error at ./mymail line 24, near "'[email protected]' ;"syntax error at ./mymail line 27, near "]"Execution of ./mymail aborted due to compilation errors.my $email = Email::Simple->create( header => [ To => '[email protected]' ; '[email protected]',
kamal
i found the solution: <code>my $email = Email::Simple->create( header => [ To => '[email protected]' , cc => '[email protected]' , cc => '[email protected]' , From => '"Deamon" <[email protected]>', Subject => $subject, ], body => $body );sendmail($email, { transport => $transport }); </code>
kamal
+4  A: 

Just use commas in the string:

my $email = Email::Simple->create(
    header => [
        To      => join(", ", @people),
        From    => '"Someone1"',
        Subject => $subject,
    ],
    body => $body
);
Chas. Owens