Drupal 8 send email

How to programmatically send email in html format in Drupal 8 (2)

  1. For implement the mail_hook() function, insert the following function into the *.module file inside the module folder. Assume the module name is 'your_module_name', the file path should be "/modules/your_module_name/your_module_name.module"
    /** * Implements hook_mail(). */
    function your_module_name_mail($key, &$message, $params) {
         switch ($key) {
             case 'normal':
                $message['subject'] = $params['title'];
                $message['body'][] = $params['body'];
Subscribe to RSS - Drupal 8 send email