ActiveCampaign / postmark-wordpress

The Official Postmark Wordpress Plugin
GNU General Public License v2.0
17 stars 17 forks source link

Add Email Recipient Override #40

Closed ChexWarrior closed 5 years ago

ChexWarrior commented 5 years ago

Hi everyone,

This PR adds a new setting on the General tab within the Postmark settings page that allows a single email address to become the only recipient for all emails sent by Postmark on the current site. The purpose is to facilitate testing on local and staging sites where emails should still be sent, but not to real users.

I'm not totally satisfied with the name I've chosen for the new setting Override Recipient (the back end option name is override_recipient_address), however I'm submitting this PR now to see if the team agrees with it's premise. I'm open to any and all suggestions to improve.

The idea comes from the suggestion given in #10

mgibbs189 commented 5 years ago

@ChexWarrior Thanks for the PR.

Honestly, I'm not sure this warrants a new UI setting. Perhaps you could use the wp_mail hook on your local/staging servers instead...

add_filter( 'wp_mail', function( $args ) {
    $args['to'] = 'some@email.com';
    return $args;
});
ChexWarrior commented 5 years ago

@mgibbs189 That's fair, however the original reason I created this PR was to avoid a patch like that. I manage an ever growing portfolio of WordPress sites at my job and thought it would be a better solution to add functionality like this to a plugin than to every WordPress site individually.