Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @nguyentrongtiep,

    I hope you are doing well.

    wp_mail is a pluggable function and it is being overridden by any of the themes or plugins. You must deactivate plugins one by one and switch the theme to the default theme, keeping an eye on the notice when it will disappear.

    Thanks and regards,
    Support Team – WPExperts

    Thread Starter nguyentrongtiep

    (@nguyentrongtiep)

    In the theme, I used function wp_mail() to send email. Also, in some plugins are using it to send email too.
    But only Post SMTP plugin create a wp_mail function below. Why don’t you use
    if (!function_exists ( ‘wp_mail’ )) {} before wp_mail() function?

    function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) {
    				// create an instance of PostmanWpMail to send the message
    				$postmanWpMail = new PostmanWpMail ();
    				// send the mail
    				
    				$mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
    				
    				$result = $postmanWpMail->send ( $to, $subject, $message, $headers, $attachments );
    				
    				if( $result ) {
    					do_action( 'wp_mail_succeeded', $mail_data );
    				} 
    
    				// return the result
    				return $result;
    			}

    Thanks

    Plugin Support M Haseeb

    (@haseeb0001)

    Hi @nguyentrongtiep ,

    Thanks for the suggestion. If you dig a bit deeper into the code execution its already there.

    REF: https://github.com/wpexpertsio/Post-SMTP/blob/76b8c71a0a54c7e698da8eca3a5bd83d10566190/Postman/PostmanWpMailBinder.php#L65

    NOTE: You must be aware of OOP concepts to understand this part of code.

    Do let us know if there is any thing else we can help you with.

    Thanks and regards,
    Mohammad Mursaleen
    Solutions Architect | WP Experts

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘FATAL Postman: Postman: wp_mail has been declared by another plugin or theme, so’ is closed to new replies.