Want To Be A Blogger  →  Start A Blog  →  Increase Traffic  →  Make Money Online  →  Recommended Things

Send Email Using SMTP And PHP Mailer

Friday, Jan 5, 2018

Tags:- PHP SMTP Gmail

In this tutorial we will tell you how to send email Using SMTP(Send Mail Transfer protocol) and PHP Mailer.You need to download PHP Mailer library to send Email even from your localhost server using gmail smtp server.

Send Email Using SMTP And PHP Mailer

To Send Email Using SMTP and PHP Mailer it takes only One step:-

  1. Make a PHP file to send Mail

Step 1.Make a PHP file to send Mail

We make a PHP file and save it with a name mail.php

$mail = new PHPMailer();
$mail->CharSet =  "utf-8";
// enable SMTP authentication
$mail->SMTPAuth = true;                  
// GMAIL username
$mail->Username = "your_email_id@gmail.com";
// GMAIL password
$mail->Password = "your_gmail_password";
$mail->SMTPSecure = "ssl";  
// sets GMAIL as the SMTP server
$mail->Host = "smtp.gmail.com";
// set the SMTP port for the GMAIL server
$mail->Port = "465";
$mail->AddAddress('reciever_email_id', 'reciever_name');
$mail->Subject  =  'SMTP Mail Testing';
$mail->Body    = 'Hi there , This is just a testing mail';
	echo "Message was Successfully Send :)";
	echo "Mail Error - >".$mail->ErrorInfo;

In this step first we download the phpmailer library and put all the files in phpmail directory and then insert the main PHPMailerAutoload.php in our document to send mails and that's all now we can send mail and from localhost also but with using internet connection.

Thats all, this is how to Send Email Using SMTP And PHP Mailer Using PHP.You can customize this code further as per your requirement and also you can attach this code to Email Verification On User Signup . And please feel free to give comments on this tutorial.

Subscribe Our Newsletter And Get Tutorials And Offers Via Email

About Me

Hello, My Name is Mudit Jain. I am a Web Developer, Professional Blogger and Digital Marketer from India. I am the founder of TalkersCode. I started this blog in february 2015 to help web developers & bloggers by providing easy and best tutorials, articles and offers for web developers and bloggers.