Reputation: 6610
I'm developing a simple email contact form which currently executes without errors and displays the success message I added.
However after testing it, the email is only received by a Microsoft Outlook address I have.
Gmail, Hotmail and Yahoo don't receive the message, and it was Gmail I was aiming for mostly.
I have checked the Spam/Junk folders in each case and no sign.
If anyone has any ideas why this is the case it would be great. I didn't post code as it does work in at least one instance, but here is the format for the 'headers' if that helps.
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
Upvotes: 0
Views: 374
Reputation: 10732
If the same code works to send email to one recipient, but not another, then the problem is with the recipients.
I suspect that it's because the recipients' email providers think your emails look like spam.
I'd recommend getting rid of the Reply-to
header, and putting the address in the From
field, for one thing - basically, the more you can do to make your emails look less like spam, the better.
If that doesn't work, try sending as limited a message as you can using your code - no extra header information added, no links in the text - and if that works, slowly start adding things back in until you stop getting the messages.
Upvotes: 1
Reputation: 2349
It could be possible that the IP you are sending from has been blacklisted (if your server is on a shared IP, somebody using that IP has sent some bad stuff).
Try from a different IP address if possible, if it works then you know the problem and can complain to your webhost.
Upvotes: 0
Reputation: 2116
then add the email whom u want to mail either it is gmail or yahoo to field of $email_to where u have hard coded it
or if you are passing you email dynmaically from a form then set it has
$email_to = $_post['email'];
then add it to your header then it should go to the recipient .
Upvotes: 0