Skip to content

Instantly share code, notes, and snippets.

@xnau
Created February 27, 2019 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xnau/7c3a999fb73ca1b02117d0c7b811bc15 to your computer and use it in GitHub Desktop.
Save xnau/7c3a999fb73ca1b02117d0c7b811bc15 to your computer and use it in GitHub Desktop.
Shows how to set the "reply-to" header on a Participants Database email template
<?php
/**
* Plugin Name: PDB Set Reply-To Header
* Description: sets the reply-to header for a Participants Database email template
*/
add_filter( 'pdb-template_email_header', 'xnau_add_reply_to_header', 20, 2 );
/**
* adds a reply-to header to a Participants Database email template
*
* @param string $header the email header
* @param string $context the context identifier
* @return string the header
*/
function xnau_add_reply_to_header( $header, $context )
{
// this is the reply to name/email to use
$replyto = 'Email Address <emailaddress@email.co>';
/*
* the test we do here is to determine if the outgoing email
* should have the header added
*/
if ( strpos( $header, '@xnau.com' ) ) {
$header .= "\n" . 'Reply-To: ' . $replyto;
}
return $header;
}
@xnau
Copy link
Author

xnau commented Feb 27, 2019

The test we do on line 24 is so we don't add that header to all outgoing Participants Database emails. You will need to adjust it so that it identifies an email that needs the header added in your particular case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment