tags:

views:

51

answers:

0

Please can some one suggest me codes to send mails using yahoo smatp, and php..

require("class.phpmailer.php"); // be sure to change this to your location!

$mail = new PHPMailer();    
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier    

$mail->Host = "smtp.mail.yahoo.com"; // sets yahoo as the SMTP server    
$mail->Port = 25; // set the SMTP port    
$mail->Username = "[email protected]"; // yahoo username    
$mail->Password = "password"; // yahoo password

$mail->From = "[email protected]";
$mail->FromName = "myname";    
$mail->AddAddress("[email protected]");    
$mail->Subject = "Test PHPMailer Message";    
$mail->Body = "Hi! \n\n This was sent with phpMailer_example3.php.";

if(!$mail->Send()) {

    echo 'Message was not sent.';    
    echo 'Mailer error: ' . $mail->ErrorInfo;

} else {

    echo 'Message has been sent.';

}

This code is giving me errrors 'Could not connect to SMTP host".