Most of the hosting providers disable nobody user on their server to send mail through script without SMTP authentication. In such cases, you have to use SMTP authentication to send mail through PHP, ASP, or ASP.Net script. phpmailer() is a very good SMTP authentication script to send emails using PHP script. Below is an example:
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp.domain.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "
email@domain.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->From = "
email@domain.com";
$mail->FromName = "Name";
$mail->AddAddress("
Recipient@emailaddress.com","Name");
$mail->AddReplyTo("
yourname@domain.com","Your Name");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the <b>HTML body</b>";
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
Note: PHPMailer must be installed on the server. For more information, go to
http://phpmailer.sourceforge.net/Thanks,