How do I send an HTML email address for a new registration in DRUPAL 6?

I want to send an HTML email to a new registered user.
I use Drupal 6. It has the ability to send mail to a new registered user, but the email address is in text format.
But now, how can I send user mail in HTML format so that I have some images as well as some headers?

+3
source share
2 answers

http://drupal.org/project/htmlmail should be what you are looking for.

"This module is very easy to use. It modifies the headers in all outgoing emails, modifying emails sent from Drupal to be HTML with header, footer and CSS."

+2
source

I know this is an older thread, but I came across it trying to do the same ... I started using http://drupal.org/project/htmlmail and realized that I really don't need 3 modules for this. .. here is a quick snippet for those trying to do this in an easier way:

function mymodule_mail_alter(&$message){
    $message['headers'] = array_merge(
    $message['headers'],  
        array(
          'MIME-Version' => '1.0',
          'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
          'Content-Transfer-Encoding' => '8Bit',
          'X-Mailer' => 'Drupal'
        )
    );
    if(!is_array($message['body'])){
        $message['body']=array($message['body']);
    }
    foreach($message['body'] as $k=>$v){
        $message['body'][$k]=str_replace(array("\n","\t"),array('<br>','    '),$v);
    }
}
+1
source

Source: https://habr.com/ru/post/1743297/


All Articles