Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <form method="post" class="enquiryForm" id="input-form" action="post-enquiry.php">
  2. <input type="text" name="Name" placeholder="Name*" required=required>
  3. <input type="mobile" name="Mobile" placeholder="Contact No*" required=required>
  4. <textarea rows="5" placeholder="Requirement*" name="Requirement"></textarea>
  5. <input type=submit value="Submit" name="submit" class=frmSubmit />
  6. </form>
  7.  
  8. My PHP post data:
  9. <?php if(isset($_POST['submit'])){
  10. //error_reporting(0);
  11. include("./mailer/class.phpmailer.php");
  12. $name = $_POST['Name'];
  13. $mobile = $_POST['Mobile'];
  14. $Requirement = $_POST['Requirement'];
  15.  
  16. $mail = new PHPMailer;
  17. $mail->IsSMTP(); // enable SMTP
  18. $mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
  19. $mail->SMTPAuth = true; // authentication enabled
  20.  
  21. $mail->Host = '';/*Specify main and backup SMTP servers*/
  22. $mail->SMTPSecure = 'ssl';
  23. $mail->Port = '465';
  24. $mail->SMTPAuth = 'true';/*Enable SMTP authentication*/
  25. $mail->Username = '';/*SMTP username*/
  26. $mail->Password = '';/*SMTP password*/
  27. $mail->setFrom($email, $name);
  28. $mail->addAddress('rajkumar@gmail.com' , 'rajkumar');
  29. $mail->isHTML(true);
  30. $mail->Subject = $subject;
  31. $mail->Body = $message;
  32. $mail->AltBody = $subject;
  33. $mail->send();
  34. if(!$mail->send()) {
  35. ?>
  36. <script type="text/javascript">
  37. window.alert("Something went wrong, your mail not sent sucssfully!");
  38. </script>
  39. <?php
  40. }
  41. else{
  42. header("location:thanks.php");
  43. }
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement