• Resolved jpcadillac

    (@jpcadillac)


    I’m using AWS SES and would like to add custom headers when sending out emails using SMTP.

    For example:
    $phpmailer->addCustomHeader('X-SES-CONFIGURATION-SET', 'ConfigSet');

    Can I use an action or filter in functions.php to do this? Is that the best way to add custom headers? If so what would the action or filter code look like?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jared Atchison

    (@jaredatch)

    Yes we do have a filter available for this, which should work for what you’re trying to do.

    $phpmailer = apply_filters( 'wp_mail_smtp_custom_options', $phpmailer );

    For reference that is wp-mail-smtp/src/Processor.php.

    Hope that helps!

    Thread Starter jpcadillac

    (@jpcadillac)

    Thank you Jared. I got it to work.

    add_filter('wp_mail_smtp_custom_options', function($phpmailer) {
      $phpmailer->addCustomHeader('X-SES-MESSAGE-TAGS', 'tagName1=tagValue1');
      $phpmailer->addCustomHeader('X-SES-CONFIGURATION-SET','myConfigurationSet');
      return $phpmailer;
    });
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom headers’ is closed to new replies.