Send Email in PHP using PHPMailer. | HackerRahul

banner of PHPMailer

 Hey Everyone, Today I am going to show you how you can Send Email in PHP using PHPMailer. Sending Mail is one of the main things in web apps and apps. but there is PHP Pre-defined function mail(); but that function is very depreciated and sends emails very slowly and there is so much bounce rate if you send it with that function.

Download Demo Subscribe on youtube

So I’ve Created a Small function Using PHPMailer Class to simplify the process of sending mail and sending the mail more faster way without any delay and bounce rate.

So let’s get started,

Below is the Full video On how to install and run this Mail function.

Please watch full video.

 

How To use the Function?

So you can use this function like any other normal function, It’s having 3 arguments

  • to (Recipient Email Address)
  • Subject of Email
  • Email Body

Here is the Sample Code for how to use the function.

So in this Sample code you I’ve just included the function on the top sendemail.php which includes the function send_mail(); with 3 argument as shown in the sample code above like send_mail($to,$subject,$body);

How to Set This function up?

Open sendemail.php and edit these lines.

Just Replace YOUR_HOST_HERE, YOUR_SMTP_USERNAME, YOUR_SMTP_PASSWORD, YOUR_EMAIL_ADDRESS and YOUR_NAME from these above lines with your SMTP Details.

And below is the file including main function.

Sendemail.php

So if the function runs without any error then the response will be 1 otherwise 0.

and all the library files of PHPMailer class are included on the top.

I hope you like the tutorial, please subscribe if you really did and subscribe my youtube channel too.

Thanks a lot.

Peace