Emails I Send From PHP Script Are Getting Flagged as Spam

Messages
1
Reaction score
0
Points
1
I'm generating an email from a php script. It gets sent but it gets flagged as spam by the receivers email filter. The script is shown below. I've been making mods to the cPanel Email Authentication but I'm really just guessing on the settings based on the headers I see in the received message. I don't have much experience with this and any suggestions are welcome.

Thanks,


<?php
$to = "web.chesdivmernmra@gmail.com";
$subject = "A Member Survey Has Been Received";
$message = "Hello Chesapeake Division Superintendent,

A member survey form has been made on the website. The survey was authenticated by the applicant. The survey responses from this member are contained in the website database:

Name:\t\t$row[xFIRST_NAME] $row[xLAST_NAME]
City/State:\t$row[xCITY]
County:\t\t$row[xCOUNTY]
Email:\t\t$row[xEMAIL]
Scale:\t\t$row[xSCALE]

Regards,
Chesapeake Division";
$message = wordwrap($message,70);
$headers = 'From: div14mer@web1.vital.x10hosting.com' . "\r\n" . 'Reply-To: div14mer@web1.vital.x10hosting.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
//mail($to, $subject, $message, $headers);
if (mail($to, $subject, $message, $headers)) {echo ("<p class='regularText'>Message sent to: $to</p>");
} else {echo ("<p class='regularText'>Message delivery failed to: $to</p>");}
?>
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
This is a regrettable consequence of allowing mail to be sent on a freely accessible server, inevitably some people are going to abuse it to send spam. Due to the mail servers being shared by all free user on a server, if Google etc class one user's mail as spam then all mail from x10 free users on that server will be categorised as spam.
It may be possible to setup an external SMTP server to send your mail, for example through a Google mail account. This would mean that the server would not be classed as spam and your email will get through, however, you will have to use the more advanced PHP mail functions rather than the simple mail().
 

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
Have a rummage through the tutorial section I do believe there was a solution, complete with cut and paste script.
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
You only solution is to use something like Google Apps to send emails, as their IPs are not blacklisted

~Callum
 
Top