Skip to content

Instantly share code, notes, and snippets.

@jbickar
Created July 8, 2015 15:02
Show Gist options
  • Save jbickar/dad74f7578c003fb9239 to your computer and use it in GitHub Desktop.
Save jbickar/dad74f7578c003fb9239 to your computer and use it in GitHub Desktop.
hook_mail_alter() implementation
/**
* Implements hook_mail_alter().
*/
function mymodule_mail_alter(&$message) {
if (($message['id'] == 'contact_page_mail') || ($message['id'] == 'contact_user_mail')) {
$message['headers']['Reply-To'] = $message['from'];
$message['body'][2] = $message['body'][1];
$message['body'][1] = 'Reply to this message using: '.$message['from'];
$message['from'] = 'noreply@example.com';
$message['headers']['From'] = $message['from'];
$message['params']['mail'] = $message['from'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment