Site icon Hip-Hop Website Design and Development

How to send custom formatted HTML mail in Cheap WordPress maintenance support plans 8 using hook_mail_alter()

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