Advertisement
Guest User

Untitled

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