I'm trying to update the "from" name in my workbench email template. I created a custom module and added the following hook ('hook_mail_alter') but it's still not updating the from name for my email template. Does the below hook look right?

function my_module_mail_alter(&$message) {
  if ($message['id'] == 'needs_review') {
  $message['from'] = 'Full Name <email@address.com>';



I'm pretty sure that $message['from'] shall be an email address.

Try to set the From header instead, like this:

$message['headers']['From'] = 'Full Name <email@address.com>';
  • Thanks so much @Jdrupal. That worked! However, I had to remove the if ($message['id'] == 'needs_review') statement for it to work. I was hoping to target a specific email template. Guess I'll need to look into that a bit more.
    – Paul H
    Nov 27 '19 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.