Since we moved to our VPS, no emails (tell-a-friend) are going out to Yahoo, Gmail , Hotmail or any emails from domains that are not hosted on the same VPS. Here is the simple test script that can send emails to email addresses whose domains are hosted on our VPS:
$to .= [email protected]; //mydomain.com would be hosted on this same VPS
$subject = 'Birthday Reminders for August';
$message = '
<title>Birthday Reminders for August</title>
<p>Here are the birthdays upcoming in August!</p>
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
Emails are not arriving unless it is to email addresses on domains that are hosted on the same VPS.
Thanks for all the replies. It tunred out that Under WHM>>Tweak settings>>Mail, we had to uncheck "Prevent the user "nobody" from sending out mail to remote addresses (PHP and CGI scripts generally run as nobody if you are not using PHPSuexec and Suexec respectively.)" to fix the issue. Unchecked it and things work but still sturggling to understand PHPSuexec and Suexec.
Did some reading and understand half of the technical stuff. Can anyone shed some light in this matter. We are concenred with a spammer using this script to spam.
By the way, thanks maiahost, I missed the From field when copy pasting. We do have that.
That's the reason the limit is there in the first place (the limit that prohibits user "nobody" from sending out emails). This is to prevent some site on the server to just start sending out emails via some compromised script, and end up blacklisting the IP of the server and all other sites hosted on there.
PHPsuexec is a method of executing PHP scripts as a user other than the Apache user (normally 'nobody' or 'www' or 'apache' depending on your distribution). This allows scripts to have escalated privileges, and at the same time prevent any script from executing commands as the Apache process.
PHPMailer is a PHP class designed to make it easy to send emails via PHP. It provides methods for attaching files, sending multi-part messages, using SMTP with authentication and other features. Very easy to use, and has quite good in-code documentation.
In order to understand recursion, one must first understand recursion.
If you feel like it, you can read my blog
Signal > Noise