1

I would like to understand why the following code does not send e-mails. I have checked both my inbox and spam folders on different e-mail addresses.

Here is contact.php:

    <?php
        if($_POST["submit"]) {
            $to = 'me@mymail.com';
            $subject = $_POST["subject"];
            $message = $_POST["message"];
            $headers = 'From: info@mydomain.com' . "\r\n" .
            'Reply-To: info@mydomain.com' . "\r\n" .
            'X-Mailer: PHP/' . phpversion();

        mail($to, $subject, $message, $headers);

$thankYou="<p class=bg>Your message has been sent.</p>";
}

?>

<!DOCTYPE html>
<html><body>

    <?=$thankYou ?>
    <form method="post" action="contact.php">
<label>Subject:</label><input type="text" name="subject">
<label>Message:</label><textarea rows="5" cols="20" name="message"></textarea>

<input type="submit" name="submit">
    </form></div></body></html>

The same script seemed to send e-mails without any problems a few hours ago.

I would highly appreciate if anyone could help or advise me.

Thank you.

Veo
  • 291
  • 3
  • 14
  • Add error reporting to the top of your file(s) right after your opening ` – Jay Blanchard Jun 12 '15 at 19:48
  • Handy tip there! I did what you said, and I received the following error: 'Notice: Undefined index: submit in /customers/1/b/d/viocube.com/httpd.www/armamentarium/contact/index.php on line 4'. – Veo Jun 12 '15 at 19:51

0 Answers0