Guest User

Untitled

a guest
Feb 6th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. $nome = $_POST['nome'];
  2. $email_usuario = $_POST['email'];
  3. $assunto = $_POST['assunto'];
  4. $mensagem = $_POST['msg'];
  5. $tipo_mensagem = isset($_POST['tipo_msg']) ? $_POST['tipo_msg'] : "";
  6.  
  7. require '../model/PHPMailer/PHPMailerAutoload.php';
  8.  
  9. $mail = new PHPMailer(true); // Passing `true` enables exceptions
  10. try {
  11. $mail->IsSMTP();
  12. $mail->CharSet="UTF-8";
  13. $mail->Debugoutput = 'html';
  14. $mail->SMTPDebug = 2; // Enable verbose debug output // Set mailer to use SMTP
  15. $mail->Host = 'smtp.umbler.com'; // Specify main and backup SMTP servers
  16. $mail->Port = 587;
  17. $mail->SMTPAuth = true;
  18. $mail->IsHTML(true);
  19. $mail->Username = 'meuemail@umbler.com'; // SMTP username
  20. $mail->Password = 'minhasenha'; // SMTP password
  21.  
  22. $mail->AddReplyTo($email_usuario, $nome); //AQUI vai o reply-to:
  23.  
  24. $mail->AddAddress('meuemail@umbler.com');
  25. $mail->Subject = $assunto;
  26. $mail->Body = '<h3>Mensagem: '.$tipo_mensagem.' '.$mensagem.'</h3>';
  27.  
  28. $mail->send();
  29. return 'Message has been sent';
  30. } catch (Exception $e) {
  31. return 'Message could not be sent. Mailer Error: '.$mail->ErrorInfo;
  32. }
Add Comment
Please, Sign In to add comment