Question

I'm working on a contact form currently and it appears to be going through, but I'm not getting the email.I unsure of what the problem is. I'm guessing it's in my PHP, but I don't see where the problem is.

HTML Markup:

<form method="post" id="contact" class="peThemeContactForm" action="mail.php">
    <div id="personal" class="bay form-horizontal">
        <div class="control-group"><!--name field-->
            <div class="controls">
                <input class="required span9" type="text" name="author" data-fieldid="0" value="Full Name" onclick="if(this.value=='Full Name') this.value=''" onblur="if(this.value=='') this.value='Full Name'">
            </div>
        </div>
        <div class="control-group"><!--email field-->
            <div class="controls">
                <input class="required span9" type="email" name="email" data-fieldid="1" value="Your Email" onclick="if(this.value=='Your Email') this.value=''" onblur="if(this.value=='') this.value='Your Email'">
            </div>
        </div>
        <div class="control-group"><!--message field-->
            <div class="controls">
                <textarea name="message" rows="12" class="required span9" data-fieldid="2" onclick="if(this.value=='Type Message') this.value=''" onblur="if(this.value=='') this.value='Type Message'">Type Message</textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="controls send-btn">
                <button type="submit" class="contour-btn red">Send Message</button>
            </div>
        </div>
    </div>
    <div class="notifications">
        <div id="contactFormSent" class="formSent alert alert-success">
            <strong>Your Message Has Been Sent!</strong> Thank you for contacting us.</div> 
        <div id="contactFormError" class="formError alert alert-error">
            <strong>Oops, An error has ocurred!</strong> See the marked fields above to fix the errors.</div>
    </div>
</form>

PHP:

<?php
if(isset($_POST['email'])){
        $mailTo = "jake_ols@live.com";
        $subject = "mail from web";
        $body = "New message from web
<br><br>
FROM: ".$_POST['email']."<br>
NAME: ".$_POST['author']."<br>
COMMENTS: ".$_POST['message']."<br>";   
        $headers = "To: Jake <".$mailTo.">\r\n";
        $headers .= "From: ".$_POST['author']." <".$_POST['email'].">\r\n";
        $headers .= "Content-Type: text/html";
        //envio destinatario
        $mail_success =  mail($mailTo, utf8_decode($subject), utf8_decode($body), $headers);        
}
?>  

No correct solution

OTHER TIPS

You most likely answer is that the server does not have mail enabled

Use phpinfo() to find which ini file you should be editing and make sure that you php server is set up to send mail.

; For Win32 only.
sendmail_from = me@example.com

Alternatively use SMTP and connect to a service like Mailgun https://documentation.mailgun.com/quickstart-sending.html#send-via-smtp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top