Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('phpmailer_init', 'configure_smtp');
- function configure_smtp(PHPMailer $phpmailer)
- {
- $phpmailer->isSMTP(); //switch to smtp
- $phpmailer->Host = 'smtp.example.com';
- $phpmailer->SMTPAuth = true;
- $phpmailer->Port = 465;
- $phpmailer->Username = 'admin@example.com';
- $phpmailer->Password = 'mypassword';
- }
- add_action('phpmailer_init', 'configure_smtp', 10, 2);
- function configure_smtp($smtp_id, PHPMailer $phpmailer)
- {
- $user_details = get_option("smtp_user_".$smtp_id);
- $phpmailer->isSMTP(); //switch to smtp
- //rest of the code
- }
- do_action("phpmailer_init", $smtp_id);
- wp_mail($to, etc);
- Catchable fatal error: Argument 2 passed to configure_smtp() must be an instance of PHPMailer
Add Comment
Please, Sign In to add comment