I use MailManager to send emails to end users for notifications. I would like to override the email address shown to the end user, using a "fake" address shown and not the real mail account used to send the email. I use the following code, however, in my gmail receiving account I don't see the [email protected]
but the real email account used.
$params['message'] = $message;
$params['subject'] = $title;
$key = 'send_email';
$langcode = \Drupal::currentUser()->getPreferredLangcode();
$send = true;
$result = $mailManager->mail($module, $key, $targetEmail, $langcode,
$params, '[email protected]', $send);
Is there a way to define a custom address to be shown to the end user? Am I missing something?