duanaoyuan7202 2019-01-01 00:16
浏览 52

Wordpress电子邮件表单不起作用; 已验证Wordpress电子邮件功能

I have a very simple form that is used to create a offer card # base don user input. The same form has a second button to send an email to the address given, but the email is not getting to the destination.

I have tried using php isset (shown in code) and have also tried ajax; neither seem to be working, but odds are I'm doing something wrong.

This form does reside within a wordpress template, and is sending using the wp_mail() function.

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>

The expected result would be an email in my inbox, but I'm getting nothing.

  • 写回答

0条回答 默认 最新

    报告相同问题?