我正在尝试创建像gmail和yahoo这样的邮件功能,我们可以在其中输入多个id,cc,bcc fiels来发送多封邮件但不能这样做。我只能在一个邮件ID上发送带有附件的单个邮件,但不能发送到,cc,bcc中的多个邮件ID。我正在使用texboxes添加邮件ID
任何人都可以帮助我。
答案 0 :(得分:0)
这取决于您对“批量”的定义。如果你正在谈论100多封电子邮件,你应该按照php.net/mail的建议使用批量邮件发件人。有一些PHP选项,但我建议一些允许你进行后台处理的东西,以便不会阻止你的脚本。
如果您只为少数收件人执行此操作,则可以在使用Bcc
时将Cc
和mail(..)
标头插入电子邮件中。上面链接的php.net页面上有完整的例子。
A(从文档中复制)示例如下:
<?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' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$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($to, $subject, $message, $headers);
?>