Most Linux hosting doesn’t allow direct mail sending through PHP mail() function due to spam security issue. In order to send email through PHP mail() function, you need to be authenticate first by the SMTP server. Simplest way to do is to use the PHPMailer. Below is the sample php code using PHPMailer.
<?php
include(“class.phpmailer.php”);
$mail = new PHPMailer();
$mail-> IsSMTP();
$mail->Host = “mail.yourdomain.com”;
$mail->SMTPAuth = true;
$mail->Username = “youruseremail@yourdomain.com”;
$mail->Password = “yourpassword”;
$mail->From = “youremail@yourdomain.com”;
$mail->FromName = “YourName”;
$mail->AddAddress($To-EmailAddress);
$mail->AddReplyTo(“youremail@yourdomain.com”, “YourName”);
$mail->IsHTML(true);
$mail->Subject = “subject is here”;
$mail->Body = “full body message here”;
$mail->AltBody = “full body message same here”;
if(!$mail->Send())
{
$Confirm = “Error in sending! Message hasn’t been sent”;
}
else
{
$Confirm = “Message has been sent”;
}
?>

September 22nd, 2008 at 7:40 am
thanks for this tutorial, it has helped me a lot
October 30th, 2008 at 3:16 pm
Does this mean I can’t send mails anymore through PHP with my Linux Minipack Hosting account?
November 12th, 2008 at 9:44 pm
Hi Daniel, this articles explains how to send email PHP through Linux hosting
December 16th, 2008 at 5:55 pm
Well, I see a problem here. Im seeing this page because I was directed by philhost techsupport. I wouldnt have guessed that I need to get authenticated (SMTP) before I could send any message. No problem with the authentication thing. But Id like to make a point here. Philhost should have made an error message that the php mail function could not be used directly and that to be able to send a message, users need to authenticate. I tried sending mails many times. The scripts are telling that it did send the messages. Why? Because php’s mail() fucntion is returning a value aside from “false”. There were no errors or warnings etc… I tried sending to different addresses coz I thought the messages were blocked for spam. I spent a hours trying to make my scripts work. Just to know in the end that it was not my scripts.
January 24th, 2009 at 11:11 pm
yahoomail is not receiving the message from this one…. only in gmail…. why is it?
February 3rd, 2009 at 2:16 am
Hi Roy Vincent, it is also a big question to others.
“Why we can send email to Gmail or to any other free email provider, but why in Yahoo sometimes can’t?”
“Why sometimes our email to Yahoo is delayed?”
“Why sometimes our email to Yahoo goes to Bulk/Spam folder?”
For many years, Yahoo didn’t come up any information about this problem?
This is possibly for some reasons:
1. Yahoo email is FREE, don’t expect too much. If you need more, get thier Yahoo business email
2. Yahoo priorities thier member internal emails rather than email comes from outside.
– Yahoo promote thier own service, if you want to solve this problem, get a Yahoo account and use it to send email to other Yahoo member.
3. Don’t send email more than 20 emails to to any Yahoo member per hour/day or else Yahoo will tag your IP/domain as bulk sender.
-When your IP/Domain is tagged, all emails from you will goes Bulk/Spam Folder.
3. Yahoo don’t provide technical support to any of thier free service. There is no other way to contact them.
Hope this few info can help.
March 5th, 2010 at 9:39 am
Hey, I found this post while searching for help with JavaScript. I’ve recently switched browsers from Google Chrome to Microsoft IE 6. Just recently I seem to have a issue with loading JavaScript. Every time I browse site that requires Javascript, my computer does not load and I get a “runtime error javascript.JSException: Unknown name”. I can’t seem to find out how to fix the problem. Any help is greatly appreciated! Thanks
January 10th, 2011 at 8:41 pm
By the way, I’m using phpmailer too. If you want to send emails in inbox and not in spam or bulk folder add this php code in your “class.phpmailer.php” file. This is the code
$a = ‘From: senders_email_address@yourdomain.com‘ . “\r\n”; // Sender’s Email Address
$b = ‘Return-Path: senders_name /n’; // Indicates Return-path
$c = ‘Reply-To: senders_name /n’; // Reply-to Address
$d = ‘X-Mailer: PHP/’ . phpversion(); // For X-Mailer
$e = ‘”Content-type: text/plain; charset=iso-8859-1″‘; // Set Content Type For Text Email
$result = $a.$b.$c.$d.$e;
Put this inside the “public function CreateHeader()” in your class.phpmailer.php