Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <?php
  2. require('phpmailer/PHPMailerAutoload.php');
  3. require('phpmailer/class.phpmailer.php');
  4. require('phpmailer/class.smtp.php');
  5. require('phpmailer/class.pop3.php');
  6.  
  7. $to = "thiago.falcao@methodinformatica.com.br"; // this is your Email address
  8. $name = $_POST['nmContato'];
  9. $from = $_POST['email']; // this is the sender's Email address
  10. $subject = $_POST['assunto'];
  11. $message = $name . " enviou a mensagem:" . "nn" . $_POST['txt_contato'];
  12.  
  13. $mail = new PHPMailer();
  14. $mail->IsSMTP();
  15. $mail->CharSet="UTF-8";
  16. $mail->Debugoutput = 'html';
  17. $mail->Host = 'email-ssl.com.br';
  18. $mail->Port = 465;
  19. $mail->SMTPSecure = 'ssl';
  20. $mail->SMTPAuth = true;
  21. $mail->IsHTML(true);
  22. $mail->Username = 'thiago.falcao@methodinformatica.com.br';
  23. $mail->Password = 'senhadoemail';
  24. $mail->From = $from; //o erro ocorre quando esse valor é thiago.friedman@hotmail.com
  25. $mail->FromName = $name;
  26. $mail->AddAddress($to);
  27. $mail->Subject = $subject;
  28. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
  29. $mail->Body = $message;
  30. $mail->SMTPDebug = 1;
  31. if(!$mail->Send()){
  32. echo 'Mailer Error: ' . $mail->ErrorInfo;
  33. }else{
  34. echo 'Message has been sent';
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement