Skip to main content

How to send auto response email in PHP


How to send auto response email in PHP


Hello friends ajj me apko autoresponce email ke bare me btaunga.

Autoresponse email kya hai or iska use kiu kiya jata hai-

App logo ne dekha hoga ki jab ham internet me kisi website me signup ,register karte hai to us website ke dwara automatically hmare email id par  thanks ka message bhej diya jata hai.iska fayda ye  hota hai ki user ko confermation mil jati hai mail ke dwara ki   uska form ,data successfully register ho chukka hai.





Yanha ham php mailer library ka use karke user ke mail id par autorespoce message send karege.




Steps-make a index.php file

index.php


<center><!DOCTYPE html>

<html>

<body>

<fieldset>

<form method="post" action="mail.php">

<h1> Autoresponse Contact Form</h1>

Firstname:<br>

<input type="text" name="first_name">

<br>

Lastname:<br>

<input type="text" name="last_name">

<br>

Cityname:<br>

<input type="text" name="city_name">

<br>

EmailId:<br>

<input type="email" name="email">

<br><br>

<input type="submit" name="save" value="submit">

</form>

</fieldset>

</body>

</html>

</center>







Step2-make a mail.php
mail.php





<center>


<?php


$conn=mysqli_connect("localhost","root","","autoresponse");




$first_name = $_POST['first_name'];


$last_name = $_POST['last_name'];


$city_name = $_POST['city_name'];


$email = $_POST['email'];




//here we check the email id is laready exit or not


$query1 = "SELECT * FROM Users WHERE email='$email'";








$res_u = mysqli_query($conn, $query1);








if (mysqli_num_rows($res_u) > 0) {




echo "email id already exit try different email";








  }else{




  //if email id not exits then user data goes in mysql database and also goes a thanks message to user email id




mysqli_query($conn,"insert into users(first_name,last_name,city_name,email) values ('$first_name','$last_name','$city_name','$email')") or die(mysqli_error());




require 'PHPMailer-master/PHPMailerAutoload.php';




$mail = new PHPMailer();




  //Enable SMTP debugging.


  $mail->SMTPDebug = 0;


  //Set PHPMailer to use SMTP.


  $mail->isSMTP();


  //Set SMTP host name


  $mail->Host = "smtp.gmail.com";


  $mail->SMTPOptions = array(


                    'ssl' => array(


                        'verify_peer' => false,


                        'verify_peer_name' => false,


                        'allow_self_signed' => true


                    )


                );


  //Set this to true if SMTP host requires authentication to send email


  $mail->SMTPAuth = TRUE;


  //Provide username and password


  $mail->Username = "yourgmilid";//enter your gamil id here


  $mail->Password = "yourgmailpassword";//enter your gmail password here


  //If SMTP requires TLS encryption then set it


  $mail->SMTPSecure = "false";


  $mail->Port = 587;


  //Set TCP port to connect to




  $mail->From = "bhupenderkashyap122@gmail.com";


  $mail->FromName = "jignesh";




  $mail->addAddress($_POST["email"]);




  $mail->isHTML(true);






  $mail->Subject = "test mail";


  $mail->Body = "Thanks For Register With Us Our Team Contact You Shortley";


  $mail->AltBody = "This is the plain text version of the email content";


  if(!$mail->send())


  {


   echo "Mailer Error: " . $mail->ErrorInfo;


  }


  else


  {


   echo "<h1>Message has been sent successfully</h1>";


  }




  }


  ?>




  </center>





Apko sirf mail.php file  code me  apni gmail id and password enter karke code ko save kar dena hai.





Step3- app data store karne ke liye mysql database create kar lijiye

CREATE TABLE `users` (

`userid` int(8) NOT NULL,

`first_name` varchar(55) NOT NULL,

`last_name` varchar(55) NOT NULL,

`city_name` varchar(55) NOT NULL,

`email` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Aap niche diye gye link se complete php code download kar lijiye autoresponse email ka.

Download Full code



Agar apko post achi lagi to apne friends ke sath jarrur share karna .and agar koi problem a rhe hai to aap comment me puch sakte ho

Thank you

Team gajabwap web in hindi



Comments

  1. very interesting code my bro.......... you saved my full day thanks for this nice. code keep it up

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Download Vimeo Thumbnail With PHP

Vimeo Thumbnail Downloader Tool – Vimeo Video Ka Thumbnail Download Karein Aaj ke is tutorial mein hum Vimeo Thumbnail Downloader Tool ke baare mein jaanenge. Is tool ki help se hum Vimeo video URL se us video ki thumbnail image obtain kar sakte hain. Agar aap PHP, Web Development, HTML, CSS aur Online Tools banana seekh rahe hain, to ye ek useful PHP project example hai. Vimeo Thumbnail Downloader Kya Hai? Vimeo Thumbnail Downloader ek simple tool hai jisme user Vimeo video ka URL enter karta hai. Tool Vimeo video ID ko identify karta hai aur available thumbnail image ko display karta hai. Example Vimeo URL: https://vimeo.com/389063954 Is URL mein: 389063954 Vimeo video ID hai. Vimeo Thumbnail Downloader Kaise Work Karta Hai? Is PHP script mein mainly do functions use kiye gaye hain: 1. getVimeoId() Ye function Vimeo URL se video ID find karta hai. 2. getVimeoThumb() Ye function Vimeo video ID ke basis par thumbnail information retrieve karta hai aur available thumbnail...

How To Create Contact Form With Validation-Php & Html

How To Create Contact Form - Hello Friends Ajj Me Apko Btaunga   Ki Kis Prakar   Ham Apni Website Ke Liye Contact Form Bnana Sakta Hai.( By Using   Php Contact Form With Validation Script ) Contact Form Hmare Website Ke Liye Bhut He Jrruri Hota Hai.Contact Form Ke Help Se He User Apna Message Website Owner(Admin) Ko Bhej Sakte Hai. Ajj Me Apko Btane Wala Hu Ki Kis Parkar Ham Contact Form Banakar Apne Website Me Add Kar Sakte Hai Or Apni Website Ke Liye Contact Form Bana Sakte Hai Is Contact Form Me   Ham Php Mail Function() Ka Use Karege . Ab Jab Be Koi User Contact Form Me Apni Information ,Message Details Fill Karke Submit Karega To Uski Sare Information Website Admin Ke Email Id Par A Jaiyegi Jo Be Admin Dwara   Niche Diye Gye Code Me Setup Ki Hogi. Used Language- ·          HTML ·          Jquery ·          Php ...

How To Send Sms From Website Using Php-Textlocal SMS

Hello Friends Ajj Me Apko Btaunga Ki Kis Prakar Aap Apni Website Me Free Sms Send Ka Option Integrate Kar Sakte Ho. Bulk sms in India-Best company Iske Liye Apko Sabse Pehle   Https://Www.Textlocal.In/Signup Par Signup Karke Account Create Karna Hai.Ye Ek Achi bulk sms provider company hai ·          Account Create Hone Ke Bad Aap Apna Username And Password Enter Karke Apne Dashboard Me Login Ho Jaiye( textlocal login) ·          Yanha Apko Text Local Company Dwara 10 Meassge Free Testing Ke Liye Diye Jayege ·          Aap Sms Plan Buy Kar Sakte Ho Is Company Dwara Bhut He Kam Prize Me Sms Pakage,plan provide  Kiye Jate Hai Textlocal Price Plans –  index.php <?php if(isset($_POST['code']) &&  isset($_POST['mobile'])){ // Authorisation details. $username = "enter your textlocal account email id here"; $hash = "...