I have been trying to send a mail using php mailer on xampp and i do get this error saying
Message could not be sent. Mailer Error: The following From address failed: [email protected] : Called Mail() without being connected
please, i need help on how to fix this.
Here is my code;
<?php
require( 'class.phpmailer.php' );
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "tls://smtp.gmail.com";
$mail->Port = 25;
$mail->Username = "[email protected]";
$mail->Password = "xxxxx";
//Sending the actual email
$mail->setFrom('[email protected]', 'Aaron');
$mail->addAddress('[email protected]', 'Aaron'); // Add a recipient
$mail->isHTML(false); // Set email format to HTML
$mail->Subject = 'Calculation form results from ';
$mail->Body = 'testing...';
if(!$mail->send()) {
echo 'Message could not be sent. ';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…