我有一个代码部分,负责从联系人表单中获取变量,并向我和我的同事发送电子邮件。
add_action(\'wp_ajax_nopriv_submit_contact_form\', \'submit_contact_form\');
// Send information from the contact form
function submit_contact_form(){
// If there is a $_POST[\'email\']...
if( isset($_POST[\'email\']) && ($_POST[\'validation\'] == true ) ) {
$email = $_POST[\'email\'];
$email_to = "[email protected]";
$fullname = $_POST[\'fullname\'];
$headers = \'From: \'. $fullname .\' <\'. $email .\'>\' . "\\r\\n";
$group_emails = array(
\'[email protected]\',
\'[email protected]\',
\'[email protected]\',
\'[email protected]\',
\'[email protected]\'
);
$email_subject = "example intro: $email";
$message = $_POST[\'text\'];
if(wp_mail($group_emails,$email_subject,$message,$headers)) {
echo json_encode(array("result"=>"complete"));
} else {
echo json_encode(array("result"=>"mail_error"));
var_dump($GLOBALS[\'phpmailer\']->ErrorInfo);
}
wp_die();
}
}
我想将4封电子邮件作为密件抄送添加到邮件头中。
我怎样才能做到这一点?我尝试了几种不同的写作方法,但没有成功。