开发者

How to send HTML email on new registration in DRUPAL 6?

开发者 https://www.devze.com 2022-12-28 08:52 出处:网络
I want to send the HTML email to new registered user. I am using Drupal 6. It has facility to send the mail to new registered user but the email 开发者_JAVA技巧is in only text format.

I want to send the HTML email to new registered user.
I am using Drupal 6. It has facility to send the mail to new registered user but the email 开发者_JAVA技巧is in only text format.

But now how can i send the user mail in HTML format so that i can have some images and also some header - footer?


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

"This module is very simple in operation. It changes headers in all outgoing e-mail modifying e-mail sent from Drupal to be HTML with the option of header, footer and CSS."


I know this is an older thread, but I stumbled across it trying to do the same thing... I started to use http://drupal.org/project/htmlmail and realized that I didn't really need 3 modules to accomplish this... here is a quick snippet for anyone trying to accomplish this in a more lightweight 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);
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号