admin管理员组

文章数量:1434922

I am looking for the files which are responsible for sending the email in WP e-commmerce, because i need to set the x-priority header = null

I already tried a general function in functions.php

add_filter('phpmailer_init','update_priority_mailer');
function update_priority_mailer($mailer){
    $mailer->Priority = '';
    return $mailer;
}

but that didn't work

EDIT

I see line 911

$result .= $this->HeaderLine('X-Priority', $this->Priority); in wp-includes\class-phpmailer.php

might be the one that i need to alter. But as i don't want to edit WP source files how can i filter this??

EDIT2

Above function did filter the X-Priority but mail-tester still gives the warning

1.6 XPRIO Has X-Priority header *

Searching where this X-Priority comes from?

I am looking for the files which are responsible for sending the email in WP e-commmerce, because i need to set the x-priority header = null

I already tried a general function in functions.php

add_filter('phpmailer_init','update_priority_mailer');
function update_priority_mailer($mailer){
    $mailer->Priority = '';
    return $mailer;
}

but that didn't work

EDIT

I see line 911

$result .= $this->HeaderLine('X-Priority', $this->Priority); in wp-includes\class-phpmailer.php

might be the one that i need to alter. But as i don't want to edit WP source files how can i filter this??

EDIT2

Above function did filter the X-Priority but mail-tester still gives the warning

1.6 XPRIO Has X-Priority header *

Searching where this X-Priority comes from?

Share Improve this question edited Jun 15, 2020 at 8:21 CommunityBot 1 asked Jan 5, 2016 at 10:15 alexalex 1,1123 gold badges17 silver badges39 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Its looks like you are trying to set a header propery which already been used to create header.

So what I would suggest is set the property and then call the createHeader() function so now again when building header your changed property should work.

You don't have to use filter you can use the action hook itself as the action is refernce to the gobal phpmailer

Example

add_action( 'phpmailer_init', 'update_priority_mailer' );
function update_priority_mailer( $phpmailer ) {
    $phpmailer->Priority = 5; //can be 1, 3, 5
    //now again construct the header so the change property will be used
    $phpmailer->createHeader();   
    // since $phpmailer is an reference variable everything will be updated   

}

You can also check other methods addCustomHeader()

本文标签: How to set xpriority headernull while using plugin WP ecommerce