Guest User

Untitled

a guest
Apr 8th, 2018
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. $mail = new PHPMailer(); // defaults to using php "mail()"
  2. $body = file_get_contents('contents.html');
  3. $body = eregi_replace("[]",'',$body);
  4. print ($body ); // to verify that I got the html
  5. $mail->AddReplyTo("reply@domain.com","my name");
  6. $mail->SetFrom('from@domain.com', 'my name');
  7. $address = "to@domain.com";
  8. $mail->AddAddress($address, "her name");
  9. $mail->Subject = "PHPMailer Test Subject via mail(), basic";
  10. $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
  11. $mail->MsgHTML($body);
  12. $mail->AddAttachment("images/phpmailer.gif"); // attachment
  13. $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
  14.  
  15. if(!$mail->Send()) {
  16. echo "Mailer Error: " . $mail->ErrorInfo;
  17. } else {
  18. echo "Message sent!";
  19. }
  20.  
  21. $mail->IsSMTP();
  22. $mail->Host = "smtp.example.com";
  23.  
  24. // optional
  25. // used only when SMTP requires authentication
  26. $mail->SMTPAuth = true;
  27. $mail->Username = 'smtp_username';
  28. $mail->Password = 'smtp_password';
  29.  
  30. $mail->AddAddress($address, "her name");
  31.  
  32. $mail->AddAddress($address);
Add Comment
Please, Sign In to add comment