How are email addresses in textarea formated? If each email is on new line, you could do like this $subject = 'Test email'; $mail_body = 'Hello! THis is test mail'; $header = "From: My Cool Name <mycoolname@mydomain.com>\r\n"; $emails = explode("\n", $_POST['textarea_field_name']); if (is_array($emails) && count($emails) > 0) { foreach ($emails as $email) { mail($email, $subject, $mail_body, $header); } } PHP: Check for more at us.php.net/mail
$subject = 'Test email'; $mail_body = 'Hello! THis is test mail'; $header = "From: My Cool Name <mycoolname@mydomain.com>\r\n"; $emails = explode(",", $_POST['textarea_field_name']); if (is_array($emails) && count($emails) > 0) { foreach ($emails as $email) { mail($email, $subject, $mail_body, $header); } } PHP:
when dealing with multiple recipients for the same email, it is often best to add the recipient addresses to the $headers for BCC (blind carbon copy), which are hidden from each recipient. That way you only have one open and close connection to the mail server, instead of many.
friends the script you gave show some errors and i had changed it little bit and it work fine now <?php $Name = ""; //senders name $mail_body = ""; //mail body $subject = ""; //subject $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields $recipient = explode(",", $_POST['recipient_list']); if (is_array($recipient) && count($recipient) > 0) { foreach ($recipient as $recipient) { mail($recipient, $subject, $mail_body, $header); //mail command :) } } ?> PHP:
"name1" <e-mail1>, "name2" <e-mail2>, e-mails are loaded into text area like this way so what all changes should i do in this script ??