Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Have Paid Memberships Pro admin checkout emails come from the customer.
/*
Have admin checkout emails come from the customer.
Add this code to a custom plugin.
*/
function pmpro_email_filter_checkout_from_users($email)
{
if(strpos($email->template, 'checkout') !== false) {
//get user info
$user = get_user_by('login', $email->data['user_login']);
//get from and from name. note that some SMTP servers (e.g. Google Mail)
//will ignore this and authmatically use the info from the Google account
$email->from = $user->user_email;
$email->fromname = $user->display_name;
//set reply to. even Google will set this
$email->headers[] = 'Reply-To: ' . $user->display_name . ' <' . $email->user_email . '>';
}
return $email;
}
add_action('pmpro_email_filter', 'pmpro_email_filter_checkout_from_users');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.