Dear, In our Website we have an option to send an e-mail..where I'amusingthe send_email function to send via SMTP.the function was workingcorrectly and e-mails were sent, but todaywhen trying to send an e-mail,it gives me: 'error: send e-mail failed.SMTP is up and running. (were-start it and we re-start the IIS serverbut nothing change)please Ineed help to know why mail are not sent.(here is the function)thank you,Sincerely,
Test script:
function send_email($to, $subject, $message, $from, $name)
{ require("includes/class.phpmailer.php");
$mail = newPHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "localhost"; // SMTP servers
$mail->SMTPAuth =false; // turn on SMTP authentication
$mail->From = $from;
$mail->FromName = $name;
$mail->AddAddress($to);// optional name
$mail->AddReplyTo($to,"");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = $message;
if(!$mail->Send())
{ print"<script>
alert('error: send e-mail failed');
window.close()
</script>";
echo "Mailer Error: " . $mail->ErrorInfo;
} else
{ print"<script>
alert('e-mail sent successfully');
window.close()
</script>";
}
}