【问题标题】:how to make Calling wp_mail() twice in same function with differnet subjects to different emails?如何在同一函数中两次调用 wp_mail(),不同主题的不同电子邮件?
【发布时间】:2021-08-12 01:09:00
【问题描述】:

如何在同一个函数中发送两封电子邮件?一封带有特定主题的电子邮件,另一封带有不同主题的电子邮件。已经尝试如下但不起作用

function v_send_mail() {
    wp_mail( "firstemail@gmail.com", $subject1, $msg, $headers );
    wp_mail( "secondemail@gmail.com", $subject2, $msg, $headers );
}

echo v_send_mail();

【问题讨论】:

    标签: php html wordpress email phpmailer


    【解决方案1】:
    Can you check this:
    function v_send_mail() 
    {
        for($i=0;$i<=1;$i++)
        {
            $emailId = "firstemail@gmail.com";
            $subject="My First Subject";
            if($i==1)
            {
                $emailId= "secondemail@gmail.com";
                $subject="My Second Subject";
            }
           wp_mail( $emailId, $subject, $msg, $headers );
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-29
      • 2018-01-08
      • 2017-06-11
      • 2021-01-05
      • 1970-01-01
      相关资源
      最近更新 更多