Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. $mail = new PHPMailer;
  2.  
  3. $mail->SMTPDebug = 3;
  4. $mail->isSMTP(); // Set mailer to use SMTP
  5. $mail->Host = 'mail.mydomain.com'; // Specify main and backup SMTP servers
  6. $mail->SMTPAuth = true; // Enable SMTP authentication
  7. $mail->Username = 'contact@mydomain.com'; // SMTP username
  8. $mail->Password = 'pass'; // SMTP password
  9. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  10. $mail->Port = 465; // TCP port to connect to
  11. $mail->setFrom('contact@mydomain.com', 'my name');
  12. $mail->addAddress('....@gmail.com', 'someone'); // Add a recipient
  13.  
  14. $mail->addReplyTo('contact@mydomain.com', 'my name');
  15. $mail->isHTML(true); // Set email format to HTML
  16.  
  17. $mail->Subject = 'subject';
  18. $mail->Body = 'msg body <b>bold!</b>';
  19. $mail->AltBody = 'Corpo alternativo caso o primeiro não seja exibido';
  20.  
  21. if(!$mail->send()) {
  22. echo 'Message could not be sent.';
  23. echo 'Mailer Error: ' . $mail->ErrorInfo;
  24. } else {
  25. echo 'Message has been sent';
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement