No matter what I do I can't seem to pass on the headers. I am trying to send html email with this but I can't seem to get it to work. I have searched high and low and can't seem to find an example of this working. Everything else with SMTP seems to work fine.

Here is the code so far:

$mail_message['id'] = 'test';
$mail_message['to'] = 'x@x.com';
$mail_message['subject'] = 'New Product Order';
$mail_message['body'] = $order_link;
$mail_message['headers'] = array('Content Type' => 'text/html');

drupal_mail_send($mail_message);

I have also tried $mail_message['headers']['Content Type'] = 'text/html' but that gives a foreach error.

Any help would be greatly appreciated!

Comments

oadaeh’s picture

Status: Active » Closed (fixed)

You can look at the code of any module that sends e-mail, including HTML. Specifically, you can look at the Mass Contact module. It currently does it incorrectly, as far as MIME is concerned, but it does work as far as SMTP an HTML are concerned.

You can also search the Internet for code samples that do what you're looking for and adapt them to The Drupal Way(tm).

If you want to wait a day or two (hopefully not more than that), I should have a version in CVS that works correctly with MIME as well. It's about 90% complete, and I'm just trying to carve out time to troubleshoot and bug fix what I've already done, so it will be about 99% complete and ready to commit.

Technically speaking, this is not an SMTP Authentication Support module issue, and belongs elsewhere.