Advertisement
Guest User

Untitled

a guest
May 3rd, 2018
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. $mail = new PHPMailer;
  2.  
  3. //$mail->SMTPDebug = 3; // Enable verbose debug output
  4.  
  5. $mail->isSMTP(); // Set mailer to use SMTP
  6. $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
  7. $mail->SMTPAuth = true; // Enable SMTP authentication
  8. $mail->Username = 'user@example.com'; // SMTP username
  9. $mail->Password = 'secret'; // SMTP password
  10. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  11. $mail->Port = 587; // TCP port to connect to
  12.  
  13. $mail->From = 'from@example.com';
  14. $mail->FromName = 'Mailer';
  15. $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient
  16. $mail->addAddress('ellen@example.com'); // Name is optional
  17. $mail->addReplyTo('info@example.com', 'Information');
  18. $mail->addCC('cc@example.com');
  19. $mail->addBCC('bcc@example.com');
  20.  
  21. $mail->WordWrap = 50; // Set word wrap to 50 characters
  22. $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  23. $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  24. $mail->isHTML(true); // Set email format to HTML
  25.  
  26. $mail->Subject = 'Here is the subject';
  27. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  28. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  29.  
  30. if(!$mail->send()) {
  31. echo 'Message could not be sent.';
  32. echo 'Mailer Error: ' . $mail->ErrorInfo;
  33. } else {
  34. echo 'Message has been sent';
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement