How to change the sender email id for some emails, using hook_mail_alter. The default SMTP configured email ID is '[email protected]'
The subject gets altered correctly using the hook_mail_alter, however, the email which I receive is still from the default configured email '[email protected]'.
function test_mail_alter(&$message) {
switch ($message['key']) {
case 'activation':
$from = "[email protected]" ;
$message['from'] = $from;
$message['headers']['From'] = $from;
$message['headers']['Sender'] = $from;
$message['headers']['Return-Path'] = $from;
$message['subject'] = 123;
break;
}
}