在同一个函数中调用wp_mail()两次(第二个不会被发送)

问题描述 投票:0回答:1

我在同一个函数中调用了两次wp_mail()函数,但另一个(第二个)没有发送。我错过了什么吗?

function v_send_mail() {
    wp_mail( "[email protected]", $subject, $msg, $headers );
    wp_mail( "[email protected]", $subject, $msg, $headers );
}

echo v_send_mail();

如果我改变他们的定位,第一封电子邮件将不会收到该电子邮件。有解决方案吗

php html wordpress
1个回答
1
投票

试试这个代码。

function v_send_mail() {
    $group_emails = array("[email protected]", "[email protected]" );
    wp_mail($group_emails, 'my subject', 'my message', $headers);
}

if(v_send_mail()){
    echo "mail sent";
}
© www.soinside.com 2019 - 2024. All rights reserved.