我有一个非常简单的表格,用于创建要约卡#用户输入。该表单具有第二个按钮,用于将电子邮件发送到给定的地址,但是电子邮件没有到达目的地。
我尝试使用php isset(代码中显示),也尝试过ajax;似乎都没有用,但是我做错了几率。
此表单确实位于wordpress模板中,并且正在使用wp_mail()函数发送。
PHP / HTML:
<?PHP
$email = $_POST['emailAdd'];
$subject = "RE: Your FREE Radio Promo Code from <REDACTED>!";
$message = $_POST['message'];
if(isset($_POST['submit'])){
sendMail();
}
function sendMail(){
wp_mail($email, $subject, $message);
}
?>
<div class="invitation-maker-container">
<form name="invite-maker" action="dashboard_template.php" method="post">
<h2>Invite Maker</h2>
<h3>ver. 1.0</h3><br>
<!--Recipient's State -->
Recipient's State:<br>
<input type="text" name="state" id="state"><br>
<!--Recipient's City -->
Recipient's Zip Code:<br>
<input type="text" name="zip" id="zip"><br>
<!--Recipient's First Name -->
First name:<br>
<input type="text" name="firstname" id="firstname"><br>
<!--Recipient's Last Name -->
Last name:<br>
<input type="text" name="lastname" id="lastname"><br><br>
<!-- Generate Number Button -->
<input type="button" value="Create Number!" id="cardButton"><br><br>
<!-- Credit Card Number -->
<p id="card-number">Card Number Will Appear Here!</p>
<div id="card-num-db"></div><br>
<h2>Email Setup:</h2>
<!-- 'To' Field -->
Recipient's Email:<br>
<input type="text" name="emailAdd" id="email"><br>
<p id="email-message" name="message"></p>
<!-- Submit Button (NOTE: Should warn sender they are about to send an email before sending!) -->
<input type="submit" name="submit" value="Submit" id="emailButton"><br>
</form>
</div>
预期结果将是收件箱中的一封电子邮件,但我什么也没收到。