• Techblog369, India
  • June 8, 2023

How To Configure A Sendinblue SMTP Relay in Postfix?

Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …

Create a simple password strength indicator with JavaScript

You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …

Hi in this article I am going to show how to implement Email SMTP using PHP Mailer.

First you have to download PHPmailer library  from github link is given below.


Chose stable version

Go to your public_html folder and upload the Library and extract the file.

Create a file contact.php in a root director. You can create a file name whatever you want.




<div class=”col-md-8″>
<div class=”cp-wrapper”>
<h4>Leave A Message!</h4>
<h2 class=”mail-failed text-danger”></h2>
<h2 class=”mail-status text-success”></h2>
<form class=”cf” id=”FormC”>
<div class=”row”>
    <div class=”col-md-6″>
        <div class=”form-group”>
                <label>Your Name*</label>
                <input type=”text” id=”name” name=”name” class=”form-control” placeholder=”Your Name Here”>
<div class=”col-md-6″>
        <div class=”form-group”>
                <label>Email Address*</label>
                <input type=”email” id=”email” name=”email” class=”form-control” placeholder=”Email Address Here”>
<div class=”col-md-6″>
        <div class=”form-group”>
                <label>Subject Line*</label>
                <input type=”text” class=”form-control” id=”subject” name=”subject” placeholder=”Subject Of Massage”>
<div class=”col-md-6″>
        <div class=”form-group”>
                <label>Telephone Number*</label>
                <input type=”text” id=”phone” name=”phone” class=”form-control” placeholder=”Phone Number”>
<div class=”col-md-12″>
        <div class=”form-group”>
            <label>Your Message*</label>
            <textarea class=”form-control” id=”body” name=”body” placeholder=”Write Your Message”></textarea>
<button type=”button” id=”contactUS” name=”contactUS” class=”cf-btn”>Send Now</button>
<!– <div class=”cf-msg” style=”display: none;”></div> –>
we are using jQuery Ajax so your page will not be reload when submit button will press.
Create a file script.js.php and link it to your footer page like below
Now paste the below code on scipts.js.php file.
  $(document).ready(function() {
    //  alert(“hjkhkjhkj”);
      var name =$(“#name”).val();
      var email =$(“#email”).val();
      var phone =$(“#phone”).val();
      var subject =$(“#subject”).val();
      var body =$(“#body”).val();
    //   console.log(name);
    //   console.log(email);
    //   console.log(phone);
    //   console.log(subject);
    //   console.log(body);
      if(name==null || name==””,email==null || email==””,phone==null || phone==””,subject==null || subject==””,body==null || body==””)
        alert(“Please Fill All Required Field”);
        return false;
            name: name,
            email: email,
            phone: phone,
            subject: subject,
            body: body
          success: function(result){
            if(result == 1){
                $(‘.mail-status’).html(‘Your Message has been Sent!!’);
                $(“.mail-failed”).html(‘Something Error!! Your Message not been Sent!!’);

Now Create a folder name ajax and under the ajax folder create a file

sendEmail.php  and paste the below code.
header(‘Content-Type: application/json’);
include(‘../Connection/Functions.php’);  //Database Conectivity
require “../PHPMailer/PHPMailerAutoload.php”;
// Data Come from database
    $edata = ShowEmailSetting();
    $oEmail = $edata[’emailUser’];
    $oPass = $edata[’emailPass’];
    $osmtp = $edata[‘esmtp’];
    $oPort = $edata[‘eport’];
    $oEmailEnc= $edata[’emailenc’];
    $oreply= $edata[’emsilreply’];
    function smtpmailer($to, $from, $from_name, $subject, $body)
        global $oEmail,$oPass,$osmtp,$oPort,$oEmailEnc;
        $mail = new PHPMailer();
        // $mail->SMTPDebug =3;
        $mail->SMTPAuth = true;
        $mail->SMTPSecure = $oEmailEnc;
        $mail->Host =$osmtp;
        $mail->Port = $oPort;
        $mail->Username = $oEmail;
        $mail->Password = $oPass;
        // $mail->SMTPAuth = true;
        // $mail->SMTPSecure = ‘ssl’;
        // $mail->Host =’mail.example.com’;
        // $mail->Port = 465;
        // $mail->Username = ‘contact@example.com’;
        // $mail->Password = ‘yourpass’;
        $mail->AddReplyTo($from, $from_name);
        $mail->Subject = $subject;
        $mail->Body = “<table><tr><th>Name</th><th>Email</th><th>Phone</th><th>Subject</th><th>Message</th></tr>
        <tr><td>”.$_POST[“name”].”</td><td>”.$_POST[“email”].”</td><td>”.$_POST[“phone”].”  </td><td>”.$_POST[“subject”].”</td><td>”.$_POST[“body”].”</td></tr></table>”;
             echo ‘0’;
            echo ‘1’;
    $to =$oreply;
    $from = $_POST[’email’];
    $name = $_POST[‘name’];
    $subj = $_POST[‘subject’];
    $msg = $_POST[‘body’];
    $error=smtpmailer($to,$from, $name,$subj,$msg);
Thanks for reading…



Leave a Reply

Your email address will not be published. Required fields are marked *