Mail can be sent using two method
● Using mail() function.
● Using PHPMailer & gmail smtp.
Step 1:
Go to github.com(download) 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.
<?php require 'phpmailer/PHPMailerAutoload.php'; $mail= new PHPMailer; $mail->isSMTP(); $mail->Host='smtp.gmail.com'; $mail->Port=587; $mail->SMTPAuth=true; $mail->SMTPSecure='tls'; $mail->Username='abcd@gmail.com'; $mail->Password='abcd@2020'; $mail->setFrom('abcd@gmail.com'); $mail->addAddress('xyz@gmail.com'); $mail->addReplyTo('abcd@gmail.com'); $mail->isHTML(true); $mail->Subject='phpmailer'; $mail->Body='WElCOME'; if(!$mail->send()) { echo "mail not sent"; } else { 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.
Here is your content of the callout box lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.