Phpmailer

出自TSK WIKI
跳至導覽 跳至搜尋

PHP mailer multiple address

<php> $mail->AddAddress('person1@domain.com', 'Person One'); $mail->AddAddress('person2@domain.com', 'Person Two');

//Better yet, add them as Carbon Copy recipients.

$mail->AddCC('person1@domain.com', 'Person One'); $mail->AddCC('person2@domain.com', 'Person Two');

//To make things easy, you should loop through an array to do this. //$mail->AddAttachment("filename"); // 設定附件檔檔名 $recipients = array(

  'person1@domain.com' => 'Person One',
  'person2@domain.com' => 'Person Two',
  // ..

); foreach($recipients as $email => $name) {

  $mail->AddCC($email, $name);

} </php>