Created
February 27, 2019 04:35
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.