PHP mail is not sending email to my email address

user3693134

I've been looking around everywhere and cannot seem to find how to make this work - it is simply not sending an email to my address. Here is my HTML form:

<form id="contactMe" name="contact" method="post" novalidate="novalidate">
    <fieldset>
        <label for="name" id="name">Name<span class="required">*</span></label>
            <input type="text" name="name" id="name" size="30" value="" required="">
            <label for="email" id="email">Email<span class="required">*</span></label>
            <input type="text" name="email" id="email" size="30" value="" required="">
            <label for="phone" id="phone">Phone</label>
            <input type="text" name="phone" id="phone" size="30" value="">
            <label for="Message" id="message">Message<span class="required">*</span></label>
            <textarea name="message" id="message" required=""></textarea>
            <label for="Answer" id="answer">Name the house pet that says “<i>woof</i>“<span class="required">*</span></label>
            <input type="text" name="answer" value="" required=""></br>
            <input id="submit" type="submit" name="submit" value="Send">
        </fieldset>
        <div id="success">
            <span class="green textcenter">
            <p>Your message was sent successfully! I will be in touch as soon as I can.</p>
            </span>
        </div> <!-- closes success div -->
        <div id="error">
            <span><p>Something went wrong, try refreshing and submitting the form again.</p></span>
        </div> <!--close error div-->
    </form>

and here is my PHP saved as mailer.php:

<?php

    $to = "[email protected]";
    $from = $_REQUEST['email'];
    $name = $_REQUEST['name'];
    $headers = "From: $from";
    $subject = "You have a message from your.";

    $fields = array();
    $fields{"name"} = "name";
    $fields{"email"} = "email";
    $fields{"phone"} = "phone";
    $fields{"message"} = "message";

    $body = "Here is what was sent:\n\n"; foreach($fields as $a => $b){   $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

    mail("[email protected]",$subject,$message,"From: $from\n");
    echo 'Mail sent';

?>

This is my first shot at working on a mailer / contact form, so sorry if it's a blatant problem. I just can't seem to find it. Any guidance would be appreciated.

I do have validation in my scripts (not posted here).

Paul Dessert

You don't have a form action defined. Try this:

<form id="contactMe" name="contact" method="post" action="mailer.php" novalidate="novalidate">

By default, the form will be submitted to its current location unless otherwise specified. In your case, point it to wherever your mail script is located

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

PHP mail is not sending email to my email address

From Dev

PHP 'mail()' Function Not Sending Email

From Dev

PHP Mail not sending to email but no errors

From Dev

Email address validation Vs sending mail for activation?

From Dev

Sending EMail from my Javascript App via GMail API - mail appears in GMail sent list, but isn't delivered to destination email address

From Dev

Sending EMail from my Javascript App via GMail API - mail appears in GMail sent list, but isn't delivered to destination email address

From Dev

php mail() headers prevent email from sending

From Dev

PHP - Sending email from form with mail function

From Dev

sending an email in php to an address stored in database

From Dev

Mail function not sending email

From Dev

Mail::queue not sending email

From Dev

Sending email with mail()

From Dev

Sending email to address not set

From Dev

php mail function from email address shows mail server address

From Dev

My php() mail script wont send emails if the from address is from a yahoo email address

From Dev

PHP email form not sending email

From Dev

How to get php mail() to send user uploaded image to my email address

From Dev

How to get php mail() to send user uploaded image to my email address

From Dev

Django; sending email from my own postfix mail server

From Dev

Django; sending email from my own postfix mail server

From Dev

Hide "To Email" Address when sending email

From Dev

Sending email to incorrect email address - are they preserved or discarded?

From Dev

Mail PEAR package not sending email

From Dev

Why is PHP mail function not recommended for sending bulk email?

From Dev

sending email via php mail function goes to spam

From Dev

Remove gmail warning email not verified when sending mail with PHP

From Dev

Sending email using php mail function - Getting slow

From Dev

Sending an email using php

From Dev

Email is not sending using php

Related Related

  1. 1

    PHP mail is not sending email to my email address

  2. 2

    PHP 'mail()' Function Not Sending Email

  3. 3

    PHP Mail not sending to email but no errors

  4. 4

    Email address validation Vs sending mail for activation?

  5. 5

    Sending EMail from my Javascript App via GMail API - mail appears in GMail sent list, but isn't delivered to destination email address

  6. 6

    Sending EMail from my Javascript App via GMail API - mail appears in GMail sent list, but isn't delivered to destination email address

  7. 7

    php mail() headers prevent email from sending

  8. 8

    PHP - Sending email from form with mail function

  9. 9

    sending an email in php to an address stored in database

  10. 10

    Mail function not sending email

  11. 11

    Mail::queue not sending email

  12. 12

    Sending email with mail()

  13. 13

    Sending email to address not set

  14. 14

    php mail function from email address shows mail server address

  15. 15

    My php() mail script wont send emails if the from address is from a yahoo email address

  16. 16

    PHP email form not sending email

  17. 17

    How to get php mail() to send user uploaded image to my email address

  18. 18

    How to get php mail() to send user uploaded image to my email address

  19. 19

    Django; sending email from my own postfix mail server

  20. 20

    Django; sending email from my own postfix mail server

  21. 21

    Hide "To Email" Address when sending email

  22. 22

    Sending email to incorrect email address - are they preserved or discarded?

  23. 23

    Mail PEAR package not sending email

  24. 24

    Why is PHP mail function not recommended for sending bulk email?

  25. 25

    sending email via php mail function goes to spam

  26. 26

    Remove gmail warning email not verified when sending mail with PHP

  27. 27

    Sending email using php mail function - Getting slow

  28. 28

    Sending an email using php

  29. 29

    Email is not sending using php

HotTag

Archive