Home  /  Coding   /  How To Use PHP Mailer | AV Coding

How To Use PHP Mailer | AV Coding

Hey guys welcome to AV Coding

Today we will learn how to use PHP Mailer.

PHP Mailer Files :

G-MAIL 2 Step Method:

G-MAIL Less Secure Settings :

Email Design Limitations:

PHP Mailer Documentation:

The complete code is explained in the video below and the source code is provided below.

require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
require 'PHPMailer/Exception.php';

$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->SMTPDebug  = 1;
$mail->Debugoutput = 'html';
$mail->Host = '';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth   = true;
$mail->Username   = "";
$mail->Password   = "*********";
$mail->SetFrom('', "AV CODING");
$mail->AddReplyTo('', "AV CODING");
// Use $email And $name as the emailid to whom you want to send the mails
$mail->AddAddress($email, $name);
$mail->Subject = "AV CODING Forgot Password";
$mail->Body = '';
if(!$mail->Send()) {
    echo "Message not sent";
  } else {
    echo "Message sent!";


Hope You Liked This Blog. Share, Comment, Subscribe And Press The Bell Icon In The Bottom Right Side For More Code Feeds.