The php.net example for mail() for $to uses two different addresses and additional header information "To: ...":
<?php // multiple recipients $to = ' aidan@example.com ' . ', '; // note the comma $to .= ' wez@example.com '; $subject = 'Birthday Reminders for August'; // message $message = '<html> ... </html>'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary < mary@example.com >, Kelly < kelly@example.com >' . "\r\n"; $headers .= 'From: Birthday Reminder < birthday@example.com >' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com ' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com ' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?>
So my question is: you need to provide $to for mail() syntax, however you cannot use the Name < email@domain.com > format, this can only be done in the additional header information, right?
So, why does the php.net example send mail to 4 different people (because they use different email addresses for $to and for header information), it really annoys me !?
And secondly, if I want to send mail only to one person (and only 1 time), and I want to use the format Name < email@domain.com > , how do I do this? Use it in $to , as well as header information? Will a person receive an email twice?
Chris
source share