• Resolved rapidsuccess

    (@rapidsuccess)


    Our new SMTP service uses custom headers to authenticate. How do we use those with your plugin. We were using postsmtp but it no longer works.

    Need to add
    X-AccountID: 0000
    X-CampaignName: system testing
    x-CampaignID:00
    X-ApiKey: LTBQbDK3pATvceDiKSsBdauEFT3DzkLakpDr5ulBfhhhfjjf

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @rapidsuccess,

    Currently, we don’t have a built-in ability to add custom headers. If you’d like to this can be accomplished with a custom little code.

    Assuming you’re using the ‘Other SMTP’ option, here is the example custom code:

    function wp_mail_smtp_custom_header( $phpmailer ) {
        $phpmailer->addCustomHeader( 'X-AccountID', '0000' );
        return $phpmailer;
    }
    add_filter( 'wp_mail_smtp_custom_options', 'wp_mail_smtp_custom_header' );

    In case it helps, here’s a tutorial on how to add such codes.

    Thread Starter rapidsuccess

    (@rapidsuccess)

    There are four headers required how do we add the others.

    Similarly.

    function wp_mail_smtp_custom_header( $phpmailer ) {
        $phpmailer->addCustomHeader( 'X-AccountID', '0000' );
        $phpmailer->addCustomHeader( 'X-CampaignName', 'system testing' );
        $phpmailer->addCustomHeader( 'x-CampaignID', '00' );
        $phpmailer->addCustomHeader( 'X-ApiKey', 'LTBQbDK3pATvceDiKSsBdauEFT3DzkLakpDr5ulBfhhhfjjf' );
        return $phpmailer;
    }
    add_filter( 'wp_mail_smtp_custom_options', 'wp_mail_smtp_custom_header' );

    I hope this helps!

    And what is the filter if you use Sendgrid SMTP ?
    For example I want to remove the unsubscribe link at the bottom with this header :

     $js = array(
            'filters' => array('subscriptiontrack' => array('settings' => array('enable' => 0)))
          );
        $phpmailer->addCustomHeader( 'X-SMTPAPI', json_encode($js) );

    Hi @editionslva,

    The same filter can be used for Sendgrid as well. You can get ‘$phpmailer’ parameter with that filter hook and remove any header. However, I’m not sure which one is for the unsubscribe link at the bottom. Please contact the plugin sending the email with that header.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Headers’ is closed to new replies.