Send Email Using PHP Mailer Script via. Gmail SMTP Server

Email is a method of exchanging information between people over communications networks. Today we are going to learn how we can send email using php script via. Gmail SMTP Server. SMTP is stands for Simple Mail Transfer Protocol. It is a basic standard for email communications. Here, we are using PHP mailer library script for email communications. Follow the below steps to configure the email application scripts in Xampp Application.1. Edit the php.ini file in the php\ subdirectory of your XAMPP installation directory (usually, C:\xampp). Within this file, find the [mail function] section and replace it with the following directives:

5.Place the php mailer script to localhost directory, where we placed php mailer libaray after download and run the below php script to send email to specific users.You need to set few mandatory details, in below script to make email communication.Mail_Script.php

Apart from above, you have to make few changes in google account. Lets complete the below steps, otherwise you would not able to send mail and scripts will not work. It will throw following error message.Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/TroubleshootingStep -1 : Login to the google account.Step -2 : Visit the below link and turn "ON" the Less secure apps indicator by allowing.https://myaccount.google.com/lesssecureapps

Finally we have completed the all the mandatory steps and scripts are ready to use. Please do comments if you have any queries.