Advertisement
Guest User

Untitled

a guest
Oct 30th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. // enviar email
  2. require_once('PHPMailer/class.phpmailer.php');
  3. require_once('PHPMailer/class.smtp.php');
  4. $mail = new PHPMailer;
  5.  
  6. $mail->isSMTP();
  7.  
  8. $mail->SMTPAuth = true;
  9. $mail->CharSet = 'UTF-8';
  10. //$mail->SMTPDebug = 2;
  11. //$mail->Debugoutput = 'html';
  12.  
  13. $mail->Host = 'smtp.meusiteuolhost.com.br';
  14.  
  15.  
  16. $mail->Port = 587;
  17.  
  18. //$mail->SMTPSecure = 'tls';
  19.  
  20. $mail->IsHTML(true);
  21. $mail->Username = "contato@meusite.com.br";
  22.  
  23. $mail->Password = "******";
  24.  
  25. $mail->setFrom('contato@meusite.com.br', 'nome site');
  26. $mail->AddReplyTo('contato@meusite.com.br', 'nome site');
  27.  
  28.  
  29. $mail->addAddress($email, $email);
  30.  
  31. $mail->Subject = $titulo_post;
  32.  
  33. $mail->Body = $mensagem;
  34. $mail->AltBody = $mensagem;
  35.  
  36. if (!$mail->send()) {
  37. echo "Erro ao enviar o post para: ".$email;
  38. //echo 'Mailer Error: ' . $mail->ErrorInfo;
  39. }
  40.  
  41. $mail->SMTPSecure = 'tls';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement