Hey there,
The more I code the more problems i find!!
I am setting up a form that allows users to submit an invitation to a friend to join the forum. The problem is my email accounts are picking the email up as spam and sending it straight to the spam folder.
I am on a reseller account and have set up a Cpanel account on that.
I have tried two ways. One with header information and one without.
Code - with header information (I have simply put in the email address I want the email to come from)
<?php
$invitee_name = $_POST['invitee_name'];
$invitee_email = $_POST['invitee_email'];
$your_name = $_POST['your_name'];
$your_message = $_POST['your_message'];
$headers = 'From: noreply@yyy.com' . "\r\n" .
'Reply-To: noreply@yyy.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = "Dear $invitee_name
This is an invitation to you from $your_name to join them at the newest exciting online ambulance forum dedicated to New xxx at http://www.xxx.com
Please join us all at the forums where freedom to discuss the most pressing matters related to the ambulance service around New xxx exists; we look forward to seeing you there.
Kind Regards
xxx.com Staff
-------------------------------------------------------------------------
*** Comment From $your_name ***
$your_message
";
echo "<p><b><font face=\"Arial\" style=\"font-size: 16pt\">Message Successfully Sent<br>
</font></b><font face=\"Arial\" size=\"2\">
<a href=\"http://www.xxx.com/index.php?\"><font color=\"#000000\">Go Back to
the Forums</font></a></font></p><br>";
echo '<pre>'.$message.'</pre>';
mail($invitee_email, 'An invite to xxx', $message, $headers); //headers on
//mail($invitee_email, 'An invite to xxx', $message); //Headers off
?>
Now with the headers off the email still goes to junk but instead of the email line saying from whatever I set in the headers it is from my account name @ my nameservers
Why does it go to spam? I know my webhost can send via mail() because it does so succesfully using the forum!!
Any help is much appreciated!