Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <?php
  2.  
  3. date_default_timezone_set('Etc/UTC');
  4.  
  5. require 'PHPMailerAutoload.php';
  6.  
  7.  
  8. $mail = new PHPMailer();
  9.  
  10.  
  11. $mail->SMTPDebug = 3;
  12. $mail->IsSMTP();
  13. //$mail->IsSMTP();
  14.  
  15. $mail->Debugoutput = 'html';
  16.  
  17.  
  18. $mail->Host = 'relay-hosting.secureserver.net';
  19.  
  20.  
  21. $mail->Port = 25;
  22.  
  23.  
  24. $mail->SMTPSecure = false;
  25.  
  26.  
  27. $mail->SMTPAuth = false;
  28.  
  29.  
  30. $mail->Username = "exemple@gmail.com";
  31.  
  32. $mail->Password = "password";
  33.  
  34.  
  35. $name = "catarina";
  36. $email = "myEmail@hotmail.com";
  37. $message = "test";
  38.  
  39. $mail->setFrom($email, $name);
  40.  
  41. $mail->addAddress('me@exemple.io');
  42.  
  43. $mail->Subject = 'Contact Site';
  44.  
  45. $mail->Body = $message;
  46.  
  47.  
  48. //send the message, check for errors
  49. if (!$mail->send()) {
  50. echo "Mailer Error: " . $mail->ErrorInfo;
  51. } else {
  52. echo "Message sent!";
  53. }
  54.  
  55. function submitForm() {
  56.  
  57. $.ajax({type:'POST', url:'email-action.php', data:$('#contact-form').serialize(), success: function(result){
  58. $('.submit').html('send');
  59. $('.send').removeClass('no-show');
  60. $('.send').removeClass('no-show-mobile');
  61. }});
  62.  
  63.  
  64.  
  65. };
  66.  
  67. <form action="/" onsubmit="return submitForm();" method="post" name="contactform" class="contact-form wow zoomIn" data-wow-delay="0.6s" id="contact-form">
  68.  
  69. <div class="col-md-6">
  70. <div class="row">
  71. <div class="col-md-12">
  72.  
  73. <input placeholder="Name" class="input-field" name="name" required="" type="text">
  74.  
  75. </div>
  76.  
  77.  
  78.  
  79. <div class="col-md-12">
  80. <input placeholder="E-mail" class="input-field" name="email" required="" type="email">
  81. </div>
  82. </div>
  83. </div>
  84. <div class="col-md-6">
  85. <textarea placeholder="Message" class="input-field" name="message"></textarea>
  86. <input value="Send Message" class="input-send submit" type="submit" name="submit">
  87. </div>
  88.  
  89.  
  90.  
  91.  
  92. <div class="col-md-12 send no-show hidden-xs"><button class=" botao btn btn-sucess"><h4 class="">Message sent sucessfully! We will get in touch shortly.</h4></button></div>
  93. <div class="col-md-12 send no-show-mobile visible-xs"><button class=" botao btn btn-sucess"><h4 class="">Message sent sucessfully!</h4></button></div>
  94.  
  95. </form>
  96.  
  97. <?php
  98.  
  99. date_default_timezone_set('Etc/UTC');
  100.  
  101. require 'PHPMailerAutoload.php';
  102.  
  103.  
  104. $mail = new PHPMailer();
  105.  
  106.  
  107. $mail->SMTPDebug = 3;
  108. $mail->IsSMTP();
  109. //$mail->IsSMTP();
  110.  
  111. $mail->Debugoutput = 'html';
  112.  
  113.  
  114. $mail->Host = 'relay-hosting.secureserver.net';
  115.  
  116.  
  117. $mail->Port = 25;
  118.  
  119.  
  120. $mail->SMTPSecure = false;
  121.  
  122.  
  123. $mail->SMTPAuth = false;
  124.  
  125.  
  126. $mail->Username = "exemple@gmail.com";
  127.  
  128. $mail->Password = "password";
  129.  
  130. ///this is the thing that change for one script to another
  131. $name = strip_tags($_POST['name']);
  132. $email = strip_tags($_POST['email']);
  133. $message = strip_tags($_POST['message']);
  134. /////
  135. $mail->setFrom($email, $name);
  136.  
  137. $mail->addAddress('me@exemple.io');
  138.  
  139. $mail->Subject = 'Contact Site';
  140.  
  141. $mail->Body = $message;
  142.  
  143.  
  144. //send the message, check for errors
  145. if (!$mail->send()) {
  146. echo "Mailer Error: " . $mail->ErrorInfo;
  147. } else {
  148. echo "Message sent!";
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement