Guest User

Untitled

a guest
Aug 21st, 2018
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. <?php
  2. $to = “myMail@gmail.com“; // <– My Mail Id
  3. $subject = “Test mail”;
  4. $message = “Hello! This is a simple test email message.”;
  5. $from = “sender@emailaddress.here“;
  6. $headers = “From:” . $from;
  7. mail($to,$subject,$message,$headers);
  8. echo “Mail Sent.”;
  9. ?>
  10.  
  11. <?php
  12.  
  13. require "mailer/autoload.php";
  14.  
  15. $name = $_POST['name'];
  16. $contact = $_POST['mobile'];
  17. $email = $_POST['email'];
  18.  
  19. $developmentMode = true;
  20. $mailer = new PHPMailer($developmentMode);
  21.  
  22. try {
  23. $mailer->SMTPDebug = 2;
  24. $mailer->isSMTP();
  25.  
  26. if ($developmentMode) {
  27. $mailer->SMTPOptions = [
  28. 'ssl'=> [
  29. 'verify_peer' => false,
  30. 'verify_peer_name' => false,
  31. 'allow_self_signed' => true
  32. ]
  33. ];
  34. }
  35.  
  36.  
  37.  
  38. $mailer->Host = 'smtp.secureserver.net';
  39. $mailer->SMTPAuth = true;
  40. $mailer->Username = 'Username@domain.com';
  41. $mailer->Password = 'Password';
  42. $mailer->SMTPSecure = 'ssl';
  43. $mailer->Port = 465;
  44.  
  45. $mailer->setFrom('Username@domain.com');
  46. $mailer->addAddress('Username@domain.com');
  47.  
  48. $mailer->isHTML(true);
  49. $mailer->Subject = 'Subject';
  50. $mailer->Body = 'Mail Body';
  51.  
  52. $mailer->send();
  53. $mailer->ClearAllRecipients();
  54. echo ' <script type="text/javascript">
  55. setTimeout(function () {
  56.  
  57. swal({
  58. title: "Congratulations!",
  59. text: "Your initiative shows your determination.",
  60. type: "success",
  61. confirmButtonText: "OK"
  62. },
  63. function(isConfirm){
  64. if (isConfirm) {
  65. window.location.href = "franchise.php";
  66. }
  67. }); });
  68. </script>';
  69.  
  70.  
  71. } catch (Exception $e) {
  72. echo ' <script type="text/javascript">
  73. setTimeout(function () {
  74.  
  75. swal({
  76. title: "OOOPs!!",
  77. text: "Entered E-Mail Address not valid Please Enter Valid Email
  78. Address",
  79. type: "error",
  80. confirmButtonText: "OK"
  81. },
  82. function(isConfirm){
  83. if (isConfirm) {
  84. window.location.href = "franchise.php";
  85. }
  86. }); });
  87. </script>';
  88. }
  89. ?>
Add Comment
Please, Sign In to add comment