<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I haven't looked at drupal 7 yet, so I'm throwing this out there for discussion.<div><br></div><div>The D6 mail api seems like it's pretty much designed for plain text emails, however, a module's implementation of hook_mail can clearly set the headers of the mail to "<span class="Apple-style-span" style="color: rgb(0, 130, 0); font-family: Monaco; font-size: 11px; ">Content-Type:&nbsp;text/html; charset=utf-8<span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; ">" and send rich text.</span></span></div><div><br></div><div>For example, I'm looking at using "forward" module for the "email this page" link on a node, and the "simplenews" module, which uses "mimemail" to send rich emails, including attachments. Both "forward" and "mimemail" modules create a html header.</div><div><br></div><div>The problem occurs when a module implements "drupal_mail_wrapper()" to build a html header when hook_mail has already done that - you can easily end up with bodies like:</div><div><br></div><div>&lt;!doctype... &lt;-- from drupal_mail_wrapper()</div><div>&lt;html></div><div>&lt;head>...&lt;/head></div><div>&lt;body>&lt;div....</div><div>&lt;!doctype. &lt;-- from hook_mail()</div><div>&lt;html></div><div>&lt;head> ... etc.</div><div><br></div><div><br></div><div>Because there are two opportunities to create the html "head" for the message: in hook_mail and drupal_mail_wrapper.</div><div><br></div><div>I'm throwing this out there for discussion, I think that the hook_mail should construct the message in a similar fashion to the Form API, specifying a theme for rendering the body part of the message (ie what goes in the &lt;body> tag) and anything special that needs to go in the head as attributes.</div><div><br></div><div>That way the message can be constructed only once.</div><div><br></div><div>Besides, email clients have been HTML friendly for a *long* time, so I don't see why Drupal shouldn't have an interface that understands rich email messages.</div><div><br></div><div>Thoughts?</div><div><br></div><div><br></div><div>Matt</div><div><br></div><div><br></div></body></html>