I am using phpMailer to Auto send mail to a specific user but it's throwing me ERROR as "2020-07-05 09:15:48 SMTP ERROR: Failed to connect to server: No connection could be made because the target machine actively refused it. (10061) SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting ERROR! Email is not sent!". Can anyone pls help me to resolve this.
Here is my code:
index.php
<?php
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 1;
$mail->HOST='smpt.gmail.com';
$mail->Port=587;
$mail->SMTPAuth=true;
$mail->SMTPSecure='TLS';
$mail->Username='[email protected]';
$mail->Password='123';
$mail->setFrom('[email protected]', 'Tariq Shaikh');
$mail->addAddress('[email protected]');
$mail->addReplyTo('[email protected]');
$mail->isHTML(true);
$mail->Subject='Notification';
$mail->Body='<h2 align=center>A new Audit Form has been Uploaded by Faculty.</h2><h3 align=center>Please check your Notification</h3>';
if (!$mail->send()) {
echo "ERROR! Email is not sent!";
}
else{
echo "Email has been sent successfully";
}
?>