我们有一个很大的php邮件表单,就像它本身使用时的魅力一样。但当我把它放在Wordpress页面中时,邮件程序不再发送(是的,在Wordpress内容中启用了php)。表格通过动议并没有显示任何错误,但它根本不发送电子邮件。显然,有些东西与Wordpress相冲突,我不知道它会是什么。有没有人经历过这个?
我想我可以在必要时发布一些表单代码,但同样,它本身也能正常工作。关于为什么Wordpress会破坏php邮件的任何想法?
<?php
if(!empty($_POST['first-name'])) {
$_POST['email'] = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$agree1 = implode(", ", $_POST['certify-info-true']);
$agree2 = implode(", ", $_POST['understand-false-info']);
$agree3 = implode(", ", $_POST['final-sig']);
foreach($_POST as $name => $value) {
$value = filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
if($name == 'submit') {
//skip
}
elseif ($name == 'certify-info-true') {
$res .= "$name : $agree1 \n \n";
}
elseif ($name == 'understand-false-info') {
$res .= "$name : $agree2 \n \n";
}
elseif ($name == 'final-sig') {
$res .= "$name : $agree3 \n \n";
}
else {
$res .= "$name : $value \n \n";
}
}
//SET here the destination email address and subject line
mail('test@email.com','Employment Application', "$res", "From: {$_POST['email']}");
//Errors
//ini_set( 'display_errors', 1 );
//error_reporting( E_ALL );
//SET here the thank you message
echo "<h2>Thank you for your interest in becoming an employee. If you meet the correct qualifications, we will contact you.</h2>";
//print_r($_POST);
} else {
?>
<form action="" id="employment" method="POST">
<!--form snipped-->
</form>
<?php
}
?>