Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. $this->load->library('PHPMailer');
  2.  
  3. $mail = new PHPMailer;
  4.  
  5. //$mail->SMTPDebug = 3; // Enable verbose debug output
  6.  
  7. $mail->isSMTP(); // Set mailer to use SMTP
  8. $mail->Host = 'hostmail'; // Specify main and backup SMTP servers
  9. $mail->SMTPAuth = true; // Enable SMTP authentication
  10. $mail->Username = 'username'; // SMTP username
  11. $mail->Password = 'password'; // SMTP password
  12. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  13. $mail->Port = 2525; // TCP port to connect to
  14.  
  15. $mail->setFrom('email@gmail.com', 'Mailer');
  16. $mail->addAddress('email@gmail.com', 'Joe User'); // Add a recipient
  17. $mail->addAddress('email@gmail.com'); // Name is optional
  18. $mail->addReplyTo('email@gmail.com', 'Information');
  19.  
  20. $mail->isHTML(true); // Set email format to HTML
  21.  
  22. $mail->Subject = 'Here is the subject';
  23. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  24. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  25.  
  26. if(!$mail->send()) {
  27. echo 'Message could not be sent.';
  28. echo 'Mailer Error: ' . $mail->ErrorInfo;
  29. } else {
  30. echo 'Message has been sent';
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement