Skip to content

Instantly share code, notes, and snippets.

@mlutfy
Created February 13, 2017 19:40
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 mlutfy/8a151e6c0f028dd9eba44dccd24a40c4 to your computer and use it in GitHub Desktop.
Save mlutfy/8a151e6c0f028dd9eba44dccd24a40c4 to your computer and use it in GitHub Desktop.
civicrm send to a friend sparkpost fix
<?php
/**
* Implements hook_civicrm_alterMailParams().
*
* Intercepts outgoing emails.
*/
function myext_civicrm_alterMailParams(&$params) {
// redmine:20627 Quickfix for PCP "send to a friend" enforce the 'from' email.
if ($params['valueName'] == 'friend') {
if (preg_match('/<([^>]+)>/', $params['from'], $matches)) {
$orig_from = $matches[1];
$params['from'] = str_replace($orig_from, 'no-reply@example.org', $params['from']);
}
}
}
@RandyTobias
Copy link

👍

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