问题是双重的。首先,设置$emailTo
after 使用该变量的标题值(因此标题中为空)。
其次$header
设置的值未在对的实际调用中使用wp_mail()
. 相反,它传递一个空值。(它在前面的行中设置,但被注释掉了,可能是为了测试。)
下面是有问题的部分:
$headers = \'From: "Klantenservice"<\' . $emailTo . \'>\' . "\\r\\n";
$emailTo = \'[email protected]\';
//$mail = wp_mail($user_email, $subject, $body, $headers);
$mail = wp_mail($emailTo, \'Contact verzoek\', $body, \'\');
应该是这样的:
$emailTo = \'[email protected]\';
$headers = \'From: "Klantenservice"<\' . $emailTo . \'>\' . "\\r\\n";
//$mail = wp_mail($user_email, $subject, $body, $headers);
$mail = wp_mail($emailTo, \'Contact verzoek\', $body, $headers);