Guest User

Untitled

a guest
Oct 28th, 2017
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. require 'phpmailer/PHPMailerAutoload.php';
  2.  
  3. if(isset($_POST['submit'])) {
  4. $mail = new PHPMailer;
  5. $firstName = $_POST['firstName'];
  6. $lastName = $_POST['lastName'];
  7. $email = $_POST['email'];
  8. $subject = $_POST['subject'];
  9. $message = $_POST['message'];
  10.  
  11. $mail->isSMTP();
  12. $mail->Host = 'mailout.one.com';
  13. $mail->SMTPAuth = true;
  14. $mail->Username = 'myemail@one.com';
  15. $mail->Password = 'mypassword';
  16. $mail->SMTPSecure = 'tls';
  17. $mail->Port = 465;
  18. $mail->AddReplyTo($email, $firstName);
  19. $mail->setFrom($email, $firstName);
  20. $mail->addAddress('example@gmail.com', 'the name');
  21. $mail->isHTML(true);
  22. $mail->Subject = $_POST['subject'];
  23. $mail->Body = '<b>From:</b><br> ' . $firstName . ' ' . $lastName . '<br> <br> <b>Message:</b> <br> ' .$message;
  24. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  25.  
  26. $mail->SMTPDebug = 3;
  27.  
  28. $mail = new PHPMailer;
  29. $mail->Host = 'mailout.one.com';
  30. $mail->SMTPAuth = true;
  31. $mail->Username = '***************';
  32. $mail->Password = '************';
  33. $mail->SMTPSecure = false;
  34. $mail->Port = 25;
  35.  
  36. /*be careful with the one.com servers strict case sensitivity
  37. renaming the file PHPMailerAutoload.php to phpmailerautoload.php could do the trick, but you need to require it in lower case as well:*/
  38. require_once 'phpmailer/phpmailerautoload.php';
  39.  
  40. $mail = new PHPMailer; //don't use brackets here!
  41. $mail->IsSMTP();
  42. $mail->SMTPAuth = true;
  43. $mail->SMTPSecure = "tls";
  44. $mail->Host = "send.one.com";
  45. $mail->Port = 587;
  46. $mail->Username = "**toChangeTp**your webemail-username";
  47. $mail->Password = "**toChangeTp**your webmail-passwort";
  48.  
  49. $useExceptions = true;
  50. $mail = new PHPMailer( $useExceptions );
  51. try {
  52. $mail->isSMTP();
  53. $mail->Host = 'send.one.com';
  54. $mail->SMTPAuth = true;
  55. $mail->Username = 'xxx@yyy.zz'; // Replace by your SMTP username
  56. $mail->Password = 'xxx123489'; // Replace by your SMTP password
  57. $mail->SMTPSecure = 'tls';
  58. $mail->Port = 587;
  59. ...
  60. $mail->setFrom('Your email-fromaddress>'); // Replace
  61. $mail->addAddress('Your to address'); // Replace
  62. $mail->addReplyTo('Your Reply Address'); // Replace
  63. ...
  64. $mail->isHTML(true);
  65. $mail->Subject = 'Your Subject';
  66. $mail->Body = 'Your body';
  67. $mail->AltBody = 'Your plain text body';
  68. ...
  69. $mail->send();
  70. } catch (Exception $e) {
  71. ...
  72. }
Add Comment
Please, Sign In to add comment