The best approach is to use a 3rd party mail program. In the past I have used PHPMailer and I love it. I make many posts with this solution to SMTP email problems in PHP and this is the fix!
http://sourceforge.net/pro
Below is the PHP code to use it. Place class.phpmailer.php into your php includes directory.
Replace text in << >> with your server information: http://www.emailaddressman
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: | <?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "<<smtpserver>>:<<stmpport>>"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "<<uname>>"; // SMTP username
$mail->Password = "<<pword>>"; // SMTP password
$mail->From = "<<email address from>>";
$mail->FromName = "<<email name from>>";
$mail->AddAddress("<<email address to>>");
$mail->AddReplyTo("<<email address from>>","<<email name from>>");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Subject";
$mail->Body = "Body text";
$mail->AltBody = $mail->Body;
$mail->Send();
?>
|