Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2.  
  3. require 'phpmailer/PHPMailerAutoload.php';
  4. if(isset($_POST['send']))
  5. {
  6. $email = "info@mydomain.com";
  7. $password = "CXTYDF";
  8.  
  9. $to_id = $_POST['toid'];
  10. $message = $_POST['message'];
  11. $subject = $_POST['subject'];
  12.  
  13. $mail = new PHPMailer;
  14.  
  15. $mail->isSMTP();
  16.  
  17. $mail->Host = 'smtp.gmail.com';
  18.  
  19. $mail->Port = 587;
  20.  
  21. $mail->SMTPSecure = 'tls';
  22.  
  23. $mail->SMTPAuth = true;
  24.  
  25. $mail->Username = $email;
  26.  
  27. $mail->Password = $password;
  28.  
  29. $mail->setFrom('info@mydomain.com', 'TeamSupport');
  30.  
  31. $mail->addReplyTo('info@mydomain.com', 'TeamSupport');
  32.  
  33. $mail->addAddress($to_id);
  34.  
  35. $mail->Subject = $subject;
  36.  
  37. $mail->msgHTML($message);
  38.  
  39. if (!$mail->send()) {
  40. $error = "Mailer Error: " . $mail->ErrorInfo;
  41. ?><script>alert('<?php echo $error ?>');</script><?php
  42. }
  43. else {
  44. echo '<script>alert("Message sent!");</script>';
  45. }
  46. }
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement