在php中向多个用户发送电子邮件

时间:2011-04-08 13:39:12

标签: php email

  

可能重复:
  How to send e-mail to multiple recipients from database query (PHP)
  Sending mass email using PHP

您好,

我想在php中向超过1000个用户发送电子邮件。任何人都可以帮助我告诉我。我怎样才能发送。我尝试使用PHP Mailer但是它给出了问题。

谢谢, Jubin Mehta

1 个答案:

答案 0 :(得分:3)

首先:函数mail()的php手册非常详细,有很多例子......

所以看:

mail( $to, $subject, $message, $header)

$to = "email@email.com";
//if you want add more 
$to .= ", anotheremail@email.com";
//you can seperate the mails with ","

$subject = "";
$message = "Hello world!";

// for html-emails you must set the content-type-header
$header  = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// so here we are, here you can add an return address
// and add Cc and Bcc, that are added addresses, they will also get the email, so email to multiple addresses
$header = 'Reply-To: webmaster@example.com' . "\r\n";
$header .= 'From: Geburtstags-Erinnerungen <geburtstag@example.com>' . "\r\n";
$header .= 'Cc: geburtstagsarchiv@example.com' . "\r\n";
$header .= 'Bcc: geburtstagscheck@example.com' . "\r\n";

因此,您可以通过“,”分隔地址来添加地址,您可以在标题中添加Cc和Bcc以及更多内容。查看手册!

注意:Cc和Bcc之间的区别在于,当您使用Cc时,所有地址也会在使用“盲目复制”的密件抄送时看到您所处理的人,因此地址无法看到您另外发送的人。