2009-05-08
meteokid
It would be nice to allow mail_send to send html emails.
This would be useful in some plugins.
The patch is very simple and require 2 minor modifications in inc/mail.php
1. Add an optional parameter
function mail_send(...,$is_html=false)
2. Compact this new parameter [function mail_send()]
before
$message = compact('to','subject','body','from','cc','bcc','headers','params');
after
$message = compact('to','subject','body','from','cc','bcc','headers','params','is_html');
3. Use this new parameter in function _mail_send_action()
before
$header .= 'Content-Type: text/plain; charset=UTF-8'.MAILHEADER_EOL;
after
$mail_mime = ($is_html) ? 'text/html' : 'text/plain';
$header .= 'Content-Type: '.$mail_mime.'; charset=UTF-8'.MAILHEADER_EOL;
This way it is backward compatible.
A better implementation would actually include both text/html and text/plain in a multipart email... but this would require a bit more modifications.