Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2017
856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2.  
  3.     include 'phpmailer.php';
  4.    
  5.     if (array_key_exists('name', $_POST)) {
  6.         $name = substr(strip_tags($_POST['name']), 0, 255);
  7.     } else {
  8.         $name = '';
  9.     }
  10.    
  11.     $email = $_POST['email'];
  12.     $message = $_POST['message'];
  13.    
  14.    
  15.     $mail -> new PHPMailer;
  16.     $mail->isSMTP();
  17.     $mail->SMTPSecure = 'ssl';
  18.     $mail->Host = 'om-travel.com';
  19.     $mail->SMTPDebug = 2;
  20.     $mail->Port = 465;
  21.     $mail->SMTPAuth = true;
  22.    
  23.     $mail->Username = "tester@om-travel.com"; //user email
  24.     $mail->Password = "blabla"; //password email
  25.     $mail->CharSet = 'utf-8';
  26.     $mail->setFrom('tester@om-travel.com', "OMTravel");
  27.     $mail->addAddress('davenathanaeld@gmail.com');
  28.     $mail->addReplyTo($email, $name);
  29.     $mail->Subject = 'Contact from : ' . $name . '(' . $email . ')';
  30.     $mail->Body = "Contact form submission\n\n" . $message;
  31.     if (!$mail->send()) {
  32.         $msg .= "Mailer Error: " . $mail->ErrorInfo;
  33.     } else {
  34.         $msg .= "Message sent!";
  35.     }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement