Guest User

Untitled

a guest
Feb 1st, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. add_action('phpmailer_init', 'configure_smtp');
  2. function configure_smtp(PHPMailer $phpmailer)
  3. {
  4. $phpmailer->isSMTP(); //switch to smtp
  5.  
  6. $phpmailer->Host = 'smtp.example.com';
  7. $phpmailer->SMTPAuth = true;
  8. $phpmailer->Port = 465;
  9. $phpmailer->Username = 'admin@example.com';
  10. $phpmailer->Password = 'mypassword';
  11.  
  12. }
  13.  
  14. add_action('phpmailer_init', 'configure_smtp', 10, 2);
  15. function configure_smtp($smtp_id, PHPMailer $phpmailer)
  16. {
  17. $user_details = get_option("smtp_user_".$smtp_id);
  18. $phpmailer->isSMTP(); //switch to smtp
  19. //rest of the code
  20. }
  21.  
  22. do_action("phpmailer_init", $smtp_id);
  23.  
  24. wp_mail($to, etc);
  25.  
  26. Catchable fatal error: Argument 2 passed to configure_smtp() must be an instance of PHPMailer
Add Comment
Please, Sign In to add comment