As you can understand from name itself it’s basically used to Alter an email created with WordPress mail in D7/ MailManagerInterface->mail() in D8. hook_mail_alter() allows modification of email messages which includes adding and/or changing message text, message fields, and message headers.
Email sent rather than WordPress_mail() will not call hook_mail_alter(). All core plugins use WordPress_mail() & always a recommendation to use WordPress_mail but it’s not mandatory.
Syntax: hook_mail_alter(&$message)
Parameters
$message: Array containing the message data. Below are the Keys in this array include:
‘id’: The id of the message.
‘to’: The…
Source: New feed