我想同时为两个不同的用户发送两封电子邮件。我使用的是php邮件功能。下面是代码。
Send_Mail('abc@example.com,abc2@example.com','Welcome',$message);
当我将它发送给单个用户时,它工作fine.But当我添加两个邮件地址它不工作..有没有其他方法可以解决这个问题?帮帮我,朋友们..
提前谢谢..
发布于 2013-03-14 07:38:44
如果您将电子邮件发送到多个地址,则可能需要在邮件头中指定收件人。
$to = 'abc@example.com' . ', ' . 'abc2@example.com';
$subject = 'Welcome';
// 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: ' . $to . "\r\n";
//$headers .= 'From: Someone <someone@example.com>' . "\r\n";
//$headers .= 'Cc: otherperson@example.com' . "\r\n";
//$headers .= 'Bcc: theotherperson@example.com' . "\r\n";
Send_Mail($to, $subject, $message, $headers);
发布于 2013-03-14 07:36:59
试试这个:
$recipients = array('abc@example.com','abc2@example.com');
foreach ($recipients as $to) {
Send_Mail($to,'Welcome',$message);
}
或
$to = 'abc@example.com,abc2@example.com';
Send_Mail($to,'Welcome',$message);
发布于 2013-03-14 07:33:58
$emailArray = array ('abc@example.com','abc2@example.com');
for($i=0;$i<count($emailArray);$i++)
{
Send_Mail($emailArray[$i],'Welcome',$message);
}
现在,您可以在阵列数据上发送无限的emails...based
https://stackoverflow.com/questions/15403516
复制相似问题