Hi
I have a simple bulk mailer which takes To, From Subject and Bcc fields from a form and uses a simple function to send the mail.
The problem is when I enter addresses in the Bcc field with line breaks, the script only sends to the first recipient and includes the remaining addresses in the body of the email.
This happens even when I remove the line breaks prior to sending the mail! The script works fine if I just enter one long line.
Heres my code:
if (isset($mailbcc)) {
$mailbcc=nl2br($mailbcc);
$mailbcc=eregi_replace('<br>', "", $mailbcc);
}
if (isset($mailbody)) {
$mailbody=stripslashes($mailbody);
}
The following prints out the list as it should be:
X@myemail.com, y@myemail.com, z@myemail.com
print "$mailbcc<br>";
print "$mailbody";
***this sends the mail
if ($action=="send") {
mail("$mailto","$mailsubject","$mailbody",
"From: $mailfrom\r\nCc: $mailcc\r\nBcc: $mailbcc"); }