0

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?

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()

| improve this answer | |
  • hmm, i see X-Priority being set X-Priority: 3 X-Mailer: PHPMailer 5.2.4 but with mail-tester.com i still get the warning * 1.6 XPRIO Has X-Priority header – alex Jan 5 '16 at 12:26
  • can you try the same with your own gmail too. From your inbox just check for view message details, where you can see more headers details too – WPTC-Troop Jan 5 '16 at 12:41
  • sent a mail to my gmail account and look into the message details, but here i can't see anything strange. X-Priority is set to 5 as i tested – alex Jan 5 '16 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.