简体   繁体   中英

PHP - multiple email addresses

Here is my php so far

$headers  = "From: webinquiries@someplace.com\n";
$headers .= "Reply-To: sales@someplace.com\n";
$headers .= 'Bcc: someone@someplace.com' . "\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=ISO-8859-1\n";
mail($to, $subject, $body, $headers);

how do i add three more email addresses to this list

You can pass a string with comma-separated e-mail addresses, or any other string that complies with RFC 2822.

Please read the mail function documentation in the PHP manual.

Create an array of email addresses, loop through each item in the array and call the mail() function. Or submit a comma separated list like so User <user@example.com>, Another User <anotheruser@example.com> .

If your emailing 'needs' require sending an extensive amount of emails, you might want to look into some third party libraries, as the mail function is very 'delicate'.

使用SwiftmailerPHPMailer之类的东西-它们消除了创建基于MIME的电子邮件的繁琐工作,并允许任意组合的任意数量的To / CC / BCC地址。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM