如何使用PHP发送批量邮件

I am trying to create mailing function like gmail and yahoo, where we can enter multiple id in to,cc,bcc fiels to send multiple mails but not able to do so. I can send single mail with attchment on only one mail id,but not to multiple mail ids in to ,cc ,bcc. I am using texboxes to add mail ids

Can any one help me.

It depends on your definition of 'Bulk'. If you're talking 100s of emails, you should use a batched mail sender as advised on php.net/mail. There are a few PHP options but I'd suggest something that will allow you to do background processing so as to not hold up your script.

If you're just doing this for a few recipients, you can inject Bcc and Cc headers into your email message when using mail(..). There are full examples on the php.net page linked above.

A (copied from documentation) example is below:

<?php

$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  .. snip
</body>
</html>
';

$headers  = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";

$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "
";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "
";
$headers .= 'Cc: birthdayarchive@example.com' . "
";
$headers .= 'Bcc: birthdaycheck@example.com' . "
";

mail($to, $subject, $message, $headers);
?>