好吧,即使你的问题很难理解,我也明白:
如果要将一条消息发送到多个电子邮件地址,您有多个选项,但可以查看两个最常用的选项:
// FIRST
// One message to many addresses, this one is simplest, but every person will see each others email address
$tomail = \'[email protected], [email protected], [email protected]\';
wp_mail( $tomail, $email_title, $message, $headers );
// SECOND
// One message per each email address
$email_array = array(\'[email protected]\', \'[email protected]\', \'[email protected]\');
foreach ( $email_array as $tomail ) {
wp_mail( $tomail, $email_title, $message, $headers );
}
第二种方法对你来说似乎是合适的,但你需要考虑你想要发送的地址的数量,因为如果地址太多,你可能会遇到托管问题,不到50个我看不到问题,可能最多100个。但这是相对的,取决于您的服务器。
PS如果您想以BC或BCC的形式发送,或者希望以发件人的形式发送,则必须使用标头部分
// For me is better as array, better control on it
$headers = array(
\'From: [email protected]\',
\'CC: [email protected]\',
\'CC: [email protected]\',
\'BCC: [email protected]\',
\'BCC: [email protected]\'
);
wp_mail( $tomail, $email_title, $message, $headers );