1

I know that sending emails with SparkPost via the API, I can disable open and click tracking with:

options.open_tracking set to false
options.click_tracking set to false

However, I'm sending with PHPmailer. I can't have my email links be converted to gibberish. I need the actual links, not the SparkPost converted links. From what I understand, this will be achieved by not tracking opens and clicks with SparkPost email.

Thanks in advance

Grokify
  • 15,092
  • 6
  • 60
  • 81
Tom
  • 1,215
  • 3
  • 19
  • 30

1 Answers1

1

You need to use X-MSYS-API custom header.

$x_msys_api = array(
  'options' => array (
    'open_tracking' => false,
    'click_tracking' => false
  )
);

$phpmailer->addCustomHeader('X-MSYS-API', json_encode($x_msys_api));

I assumed you've $phpmailer object (instance of PHPMailer class), replace it accordingly.

Here is official documentation. Here is an example use.

HungryCoder
  • 7,506
  • 1
  • 38
  • 51
  • This won't work; the `addCustomHeader` method doesn't accept arrays as header values - you'll get an array to string conversion error. Setting a header sounds like the right approach, but you'll need to format the value correctly first. – Synchro Jan 24 '17 at 19:35
  • @Synchro sorry, my bad. you're right. you need to use json_encode. i've updated the answer – HungryCoder Jan 24 '17 at 19:56