Send Mail using PHPMailer & Gmail Smtp

Mail can be sent using two method
● Using mail() function.
● Using PHPMailer & gmail smtp.

Steps to send mail using PHPMailer:

Step 1:

Go to to download PHPMailer library. Select Branch 5.2 stable version & Download the zip file.

Step 2:

Now extract the zip files. & copy these three files & paste it in another folder.
1. class.phpmailer
2. class.smtp
3. PHPMailerAutoload

Step 3:

Open PHPMailerAutoload file & replace function __autoload($classname) with function spl_autoload_register($classname)

Step 4:

Write this gmail smtp code to send mail.


        require 'phpmailer/PHPMailerAutoload.php';
        $mail= new PHPMailer;





           echo "mail not sent";
             echo "mail sent Successfully";


Step 5:

Go to Manage your google account setting of the email from which you want to send mail->go to Security ->turn off 2 step verification & turn on Less secure app access.

Follow all the above steps. The mail will be sent in 1 or 2 seconds. Now you will be able to send mail faster.

Did you like our works?

Here is your content of the callout box lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.