Advertisement
dimkiriaoks

PHPMailer

Jun 19th, 2024
851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. use PHPMailer\PHPMailer;
  3. use PHPMailer\PHPMailer\Exception;
  4. require './vendor/autoload.php';
  5.  
  6.  
  7. $phpmailer = new PHPMailer\PHPMailer;
  8. $phpmailer->isSMTP();
  9. $phpmailer->Host = 'sandbox.smtp.mailtrap.io';
  10. $phpmailer->SMTPAuth = true;
  11. $phpmailer->Port = 2525;
  12. $phpmailer->Username = 'your username';
  13. $phpmailer->Password = 'your password';
  14. $phpmailer->SMTPDebug = 2;                   // Enable verbose debug output
  15. $phpmailer->setFrom('test@email.com', 'Name');  
  16. $phpmailer->addAddress('receiver1@email.net');
  17. $phpmailer->isHTML(true);    
  18. $phpmailer->Subject = 'Subject';
  19. $phpmailer->Body    = 'HTML message body in <b>bold</b>!';
  20. $phpmailer->AltBody = 'Body in plain text for non-HTML mail clients';
  21.  
  22. $phpmailer->send();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement