Hi all,

I am updating my module to drupal 5. every thing is working again except for the mailing part.

I send several html mails with this module, but the content type with the new mailing function drupal_mail does not change.

4.7

<?php
$header = "From: ".$mailto."\r\n" .
"Content-Type: text/html";
user_mail($to, $subject, $message, $header);
?>

sends a html mail

5.0

<?php
$mailkey = "1";
$headers["MIME-Version"] = '1.0';
$headers["Content-Transfer-Encoding"] = '8bit';
$headers["Content-Type"] = "text/html; charset='utf-8';";
drupal_mail($mailkey, $to, $subject, $message, $mailto, $headers);
?>

sends a plain text mail.

How do i get the html mail working in drupal 5?

all help is welkom

Comments

Renze’s picture

i had the smtp module installed, and smtp module for drupal 5 is a little buggy with the headers array

bs’s picture

Hi Renze,
Any update ? Did you find any solution? I need to send html mail for a project on login register , update , delete of his node by admin etc..
Regards,
Bs.

Christopher Herberte’s picture

You could try the HTML Mail module http://drupal.org/project/htmlmail it's in dev still although i'm using it on a production site with no ill effects. If the module does not help maybe the source will give some answers.

conan_o’s picture

Because of a funny line in smtp.module, I found that changing:

$headers['Content-Type'] = "text/html; charset=utf-8";

to

$headers['Content-Type'] = " text/html; charset=utf-8";

works (there is a space just before the text/html).

It's because in order to turn the htmlize mail in smtp.module, line 195, it searches for " text/html", not "text/html" (again, notice the extra space).

avior’s picture

I was about to loose my mind

This solved my problem , thank you for sharing