CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

04 October, 2018

How to Send Email using PHP mail() Function

 Programing Coderfunda     October 04, 2018     mail, php, php mail function     No comments   

Note: ** 

Hi Guys: 1st you change the name of your Username & Password then change the From().

you change the AddAddress where you are send the email address .
1.if you have a forum then you want to send the mail then you change the addaddress() mail id.
2.If you want to user fill the forum and send the message you then you fill the him mail id .

In Body  $mail->Body    = ""; you can change accourding your message. i give you a simple forum & you can see the output in down

 require("PHPMailer_5.2.0/class.phpmailer.php");
           
            if(isset($_POST['submit'])){
              $you_looking = $_POST['you_looking'];
              $name = $_POST['name'];
              $email = $_POST['email'];
              $eventtype = $_POST['eventtype'];
              $city = $_POST['city'];
              $phone = $_POST['phone'];
              $date = $_POST['date'];
              $guests = $_POST['guests'];
              $message = $_POST['message'];


              $mail = new PHPMailer();
              $mail->IsSMTP();                                     
              $mail->Host = "mail.bluefox.agency"; 
              $mail->SMTPAuth = true;   
              $mail->Username = "codeerfunda@blue.agency";
              $mail->Password = "test@jk";
              $mail->From = "codeerfunda@codeer.agency";
              $mail->FromName = "Codeerfunda";
              $mail->AddAddress('codeerfunda@gmail.com');
              $mail->WordWrap = 50;                               
              $mail->IsHTML(true);                               
              $mail->Subject = "App Installation Link";
              $mail->Body    = "<!DOCTYPE html> <html> <head> <title>Invoice</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet'> <link href='https://fonts.googleapis.com/css?family=News+Cycle:700' rel='stylesheet'> </head> <body> <table width='500' align='center' cellpadding='0' cellspacing='0' style='margin: auto;'> <tr> <td> <table align='center' width='500' cellpadding='0' cellspacing='0' border='0' style='background: #000;border: 1px solid #dddddd;'> <tr><td height='15' align='center'></td></tr> <tr> <td width='100%' align='center'> <a href='#'> <img src='http://bluefox.agency/images/logo.png' style='display: block;width: 200px;'> </a> </td> </tr> <tr><td height='15' align='center'></td></tr> </table> <table style='border-collapse:collapse;width:100%;border-top:1px solid #dddddd;border-left:1px solid #dddddd;margin-bottom:20px'> <tbody> <tr> <td style='font-family: Open Sans,sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>You are looking for</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$you_looking."</td> </tr><tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Company / Institution</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$name."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Company / Institution</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$company."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Email</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$email."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Phone number *</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$phone."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>City</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$city."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Event Location</td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$location."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Date of the event </td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$date."</td> </tr> <tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Event Type </td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$eventtype."</td> </tr><tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Number of Guests </td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$guests."</td> </tr><tr> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:2px solid #dddddd;padding:12px;text-transform: uppercase;font-weight: 600;font-family: -apple-system,Helvetica,Arial,sans-serif;color: #000; width: 150px;'>Event Details * </td> <td style='font-family: Open Sans, sans-serif;font-size:14px;border-right:1px solid #dddddd;border-bottom:1px solid #dddddd;text-align:left;padding:7px'>".$message."</td> </tr> </tbody> </table> </td> </tr> </table> </body> </html> ";


              if(!$mail->Send())
              {
                echo "Message could not be sent.";
                echo "Mailer Error: " . $mail->ErrorInfo;
                exit;
              }
              else
              {
                echo "success";
                exit;
              }

               //echo ('action.php');
               //include('inquiry.php');

            }
              ?>

OutPut :>>>

NAMEsdf
COMPANY / INSTITUTIONsdf
EMAILdemo@gmail.com
PHONE NUMBER *ssdfsdf
CITYsdf
EVENT LOCATIONsdf
DATE OF THE EVENT10/03/2018
EVENT TYPESocial
NUMBER OF GUESTS1 - 100
EVENT DETAILS *sdasdfa

Jquery Validation : 


 <script src="js/common_scripts.min.js"></script>
    <script src="js/functions.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.3.26/jquery.form-validator.min.js"></script>
    <script src="https://cdn.jsdelivr.net/jquery.validation/1.15.1/jquery.validate.min.js" type="text/javascript" charset="utf-8" async defer></script>
    <script src="js/messages_es.js"></script>
    <script src="js/jquery.validate.js"></script>

    <script type="text/javascript">
      $(document).ready(function(){
      $("#commentForm").validate({
      rules: {
      vname: {
      required: true,
      },
      vcompany: {
      required: true,
      },
      vemail: {
      required: true,
      email: true,
      },
      vphone: {
      required: true,
      number: true,
      minlength: 10,
      maxlength: 11,
      },
      vcity: {
      required: true,
      },
      vlocation: {
      required: true,
      number: true,
      },
      vdate: {
      required: true,
      },
      veventtype: {
      required: true,
      },
      vguests: {
      required: true,
      },
      vmessage: {
      required: true,
      },
      },
      vmessages: {     
      vname: {
      required: "Enter Name",
      },
      vcompany: {
      required: "Enter company Name",
      },
      vemail: {
      required: "Enter Email Address",
      email: "Enter Valid Email Address",
      },
      vphone: {
      required: "Enter Your Mobile Number",
      },
      vcity: {
      required: "Enter Your city",
      },
      vlocation : {
      required: "Enter Your Event Location",
      },
      vdate: {
      required: "Enter Your date",
      },
      veventtype: {
      required: "Enter Your eventtype",
      },
      vguests: {
      required: "Enter Your guests",
      },
      vmessage: {
      required: "Enter Your Message",
      },

      },submitHandler: function (form) {
      $.post('book-sound-lights-projector.php?submit=add',$('#commentForm').serialize(),function(data)
      {
      if(data == "success")
      {
      /*$("#commentForm")[0].reset()*/;
    swal("Success Message Title", "Well done, you pressed a button", "success");
    setTimeout(function () {
     window.location.href = 'https://bluefox.agency/book-sound-lights-projector.php'; //Will take you to Google.
                 }, 2500);

      }
      else
      {
    error("Error Message Title", "Unsubmitted data", "success");
     
      }
      })
      }
      }
      );
      });
    </script>

Note :1. #commentForm this is a id use in html form.

2. swal("Success Message Title", "Well done, you pressed a button", "success");

this is a popup window. when you click the send button then use and show th message send.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

HTML
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Book Sound, Lights, Projector, Stage, LED Etc For Your Event</title>
    <?php include 'top.php'?>
    <link href="css/vendors.css" rel="stylesheet">
    <style type="text/css">
      .nice-select{display: none !important;}
      select{
        display: block !important;
        border-radius: 0px 5px 5px 0px;
        border: 1px solid #eee;
        margin-bottom: 15px;
        width: 87%;
        height: 40px;
        float: left;
        padding: 0px 15px;
      }
    </style>
  </head>
  <body>
    <?php include 'header.php'?>
    <div class="container-flude">
      <div class="row">
        <div class="bg_img2 col-lg-12 col-md-12 col-sm-12 col-xs-12">
          <div class="overlayer-search">
            <div class="container">
              <div class="row">
                <h2 class="art-searchsty">Let us book logistics on your behalf. We’ll source you the best logistics in Affordable price!</h2>
                <div class="btn_125211">
                  <a href="#" onclick="window.history.go(-1)">
                  <i class="fa fa-long-arrow-left" aria-hidden="true"></i> go to previous page
                  </a>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="container">
          <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
              <form class="inquiry-form" id="commentForm" method="post">
                <div class="contentform">
                  <div id="sendmessage"> Your message has been sent successfully. Thank you. </div>
                  <div class="form-group">
                    <p>You are looking for <span>*</span></p>
                    <span class="icon-case"><i class="fa fa-eye"></i></span>
                    <select  name="you_looking" style="width: 94%">
                      <option selected hidden></option>
                      <option>Sound</option>
                      <option>Lights</option>
                      <option>Stage</option>
                      <option>Led</option>
                      <option>Projector</option>
                      <option>Others</option>
                    </select>
                    <div class="validation"></div>
                  </div>
                  <div class="leftcontact">
                    <div class="form-group">
                      <p>Your Name <span>*</span></p>
                      <span class="icon-case"><i class="fa fa-user"></i></span>
                      <input type="text" name="name">
                      <div class="validation"></div>
                    </div>
                    <div class="form-group">
                      <p>E-mail Address<span>*</span></p>
                      <span class="icon-case"><i class="fa fa-envelope-o"></i></span>
                      <input type="email" name="email">
                      <div class="validation"></div>
                    </div>
                    <div class="form-group">
                      <p>Event Type <span>*</span></p>
                      <span class="icon-case"><i class="fa fa-glass"></i></span>
                      <select name="eventtype" style="display: block !important;">
                        <option selected hidden></option>
                        <option>Social</option>
                        <option>Corporate</option>
                        <option>Party</option>
                        <option>Exhibition</option>
                        <option>Etc</option>
                      </select>
                      <div class="validation"></div>
                    </div>
                  </div>
                  <div class="rightcontact">
                    <div class="form-group">
                      <p>Your City <span>*</span></p>
                      <span class="icon-case"><i class="fa fa-building-o"></i></span>
                      <input type="text" name="city">
                      <div class="validation"></div>
                    </div>
                    <div class="form-group">
                      <p>Phone number <span>*</span></p>
                      <span class="icon-case"><i class="fa fa-phone"></i></span>
                      <input type="text" name="phone">
                      <div class="validation"></div>
                    </div>
                    <div class="form-group">
                      <p>Date of the event <span>*</span></p>
                      <span class="icon-case"><i class="fa fa-calendar"></i></span>
                      <input type="text" name="date" id="booking_date" data-lang="en" data-min-year="2018" data-max-year="2028" data-disabled-days="10/17/2017,11/18/2017">
                      <div class="validation"></div>
                    </div>
                  </div>
                  <div class="form-group">
                    <p>Number of Guests <span>*</span></p>
                    <span class="icon-case"><i class="fa fa-sort-numeric-asc"></i></span>
                    <select name="guests" style="width: 94%">
                      <option selected="" hidden=""></option>
                      <option>1 - 100</option>
                      <option>101 - 300</option>
                      <option>301 - 500</option>
                      <option>501 - 1000</option>
                    </select>
                    <div class="validation"></div>
                  </div>
                  <div class="form-group">
                    <span class="icon-case"><i class="fa fa-comments-o"></i></span>
                    <textarea name="message" rows="14" placeholder="Write us more about the event so that we can offer you the best possible price and source you the best thing" style="padding: 5px 15px"></textarea>
                    <div class="validation"></div>
                  </div>
                </div>
                <button class="bouton-contact btn-hvr-44" type="submit" id="sweet_alert_success" name="submit" value="submit"><span>Send My Request</span></button>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="sec-bannerbg col-lg-12 col-md-12 col-sm-12 col-xs-12">
      <div class="container">
        <div class="row">
          <div class="banner-secadv" style="text-align: center;">
            <img src="images/addbanner.png">
          </div>
        </div>
      </div>
    </div>
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • How to Send Email using PHP mail() FunctionNote: ** Hi Guys: 1st you change the name of your Username & Password then change the From().you change the AddAddress where you are sen… Read More
  • How to Send Email using PHP mail() Function Note: **  Hi Guys: 1st you change the name of your Username & Password then change the From(). you change the AddAddress where you… Read More
  • Codeigniter Multiple Upload Images/ files / video / audio filesHi all, this is nothing new but i thought that maybe someone will use this in the future.NOTICE. The code it’s not mine but i’ll share it anywayso wha… Read More
  • Codeigniter Multiple Upload Images/ files / video / audio files Hi all, this is nothing new but i thought that maybe someone will use this in the future. NOTICE. The code it’s not mine but i’ll share it anyway so… Read More
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Spring boot app (error: method getFirst()) failed to run at local machine, but can run on server
    The Spring boot app can run on the online server. Now, we want to replicate the same app at the local machine but the Spring boot jar file f...
  • Log activity in a Laravel app with Spatie/Laravel-Activitylog
      Requirements This package needs PHP 8.1+ and Laravel 9.0 or higher. The latest version of this package needs PHP 8.2+ and Laravel 8 or hig...
  • Laravel auth login with phone or email
          <?php     Laravel auth login with phone or email     <? php     namespace App \ Http \ Controllers \ Auth ;         use ...
  • Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh
    I had follow these steps to install an configure firebase to my cordova project for cloud messaging. https://medium.com/@felipepucinelli/how...
  • Vue3 :style backgroundImage not working with require
    I'm trying to migrate a Vue 2 project to Vue 3. In Vue 2 I used v-bind style as follow: In Vue 3 this doesn't work... I tried a...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

  • Failed to install 'cordova-plugin-firebase': CordovaError: Uh oh - 9/21/2024
  • pyspark XPath Query Returns Lists Omitting Missing Values Instead of Including None - 9/20/2024
  • SQL REPL from within Python/Sqlalchemy/Psychopg2 - 9/20/2024
  • MySql Explain with Tobias Petry - 9/20/2024
  • How to combine information from different devices into one common abstract virtual disk? [closed] - 9/20/2024

Laravel News

  • Validate Controller Requests with the Laravel Data Package - 5/19/2025
  • Deployer - 5/18/2025
  • Transform JSON into Typed Collections with Laravel's AsCollection::of() - 5/18/2025
  • Auto-translate Application Strings with Laratext - 5/16/2025
  • Simplify Factory Associations with Laravel's UseFactory Attribute - 5/13/2025

Copyright © 2025 CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda