# Email Form does not send messages

**URL:** <https://forum.kirupa.com/t/email-form-does-not-send-messages/262186>\
**Category:** flash\
**Created:** [June 3, 2008, 11:41pm UTC](https://forum.kirupa.com/t/email-form-does-not-send-messages/262186 "2008-06-03T23:41:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pomolives](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@pomolives](https://forum.kirupa.com/u/pomolives)\
**Post date:** [June 3, 2008, 11:41pm UTC](https://forum.kirupa.com/t/email-form-does-not-send-messages/262186/1 "2008-06-03T23:41:36Z")

</div>

The email form on my contact page isn’t working.  
It has **3 input fields** : name, email, message, and a \*\*send button; \*\*when clicked, the form should change to a “message sent” message and the send button changes to a “Back” button.

For some reason, i only receive an email in my inbox if the email field is my own personal email, the same one it sends to. But, if any other email is typed in, i don’t get the message.

Also, after "send " is clicked, the “message sent” message & back button don’t show up.

this is my PHP file:  
\<?php  
$sendTo = "myEmail@yahoo.com";  
$subject = “[Website Response Form](http://savitha.net/)”;

$headers = “From: " . $\_POST[“name”] .”\<" . $\_POST[“email”] ."\>  
";  
$headers .= "Return-Path: " . $\_POST[“email”]. "  
";  
$message = $\_POST[“message”];

mail($sendTo, $subject, $message, $headers);  
?\>

is there something wrong with it?

help, please.

---

<div class="post-metadata">

**Author:** ![jon\_bla](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jon\_bla](https://forum.kirupa.com/u/jon_bla)\
**Post date:** [June 6, 2008, 5:39pm UTC](https://forum.kirupa.com/t/email-form-does-not-send-messages/262186/2 "2008-06-06T17:39:32Z")

</div>

try it without the “Reurn-path”

---

<div class="post-metadata">

**Author:** ![djheru](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/djheru/32/3190_2.png) [@djheru](https://forum.kirupa.com/u/djheru)\
**Post date:** [June 6, 2008, 6:03pm UTC](https://forum.kirupa.com/t/email-form-does-not-send-messages/262186/3 "2008-06-06T18:03:21Z")

</div>

The reason is because you are trying to spoof the from header. Let’s say your domain is [yourdomain.com](http://yourdomain.com). Now, a user comes along and tries to contact you using your form and their email address is [joe@gmail.com](mailto:joe@gmail.com)

When you send an email from your POP mailserver at [yourdomain.com](http://yourdomain.com), the SMTP server at [yourdomain.com](http://yourdomain.com) receives the message and immediately knows that it is not coming from [gmail.com](http://gmail.com)’s servers, so it assumes it is spam and blocks it at the server.

The proper way would be to use a real email address that is on your server as the from email addr and put the from name as something like “WebsiteUser”. Then, use the email that they entered as the Reply-to header, so you can just hit the “reply” button in your email client to reply to them.

Also, it is very important that you strip out any newline characters “  
” from the input that you get from the form otherwise a spammer could inject a “bcc” header into your email and use it to send spam to other people.
