使用 PHPmailer 发送的 SparkPost - 如何禁用打开和点击跟踪?

SparkPost sending with PHPmailer - how do I disable open and click tracking?

我知道通过 API 使用 SparkPost 发送电子邮件,我可以禁用打开和点击跟踪:

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

但是,我正在使用 PHPmailer 发送。我不能将我的电子邮件链接转换为乱码。我需要实际链接,而不是 SparkPost 转换后的链接。据我了解,这将通过不使用 SparkPost 电子邮件跟踪打开和点击来实现。

提前致谢

您需要使用 X-MSYS-API 自定义 header。

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

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

我假设您已经 $phpmailer object(PHPMailer class 的实例),相应地替换它。

这里是official documentation. Here is an example use