In current 1.0-git (master) and in 0.9.5 I see that $isHTML is set to false if we pre-define body content by hooks 'message_compose' and/or 'message_compose_body' regardless whether or not user preference is 'HTML':
./program/steps/mail/compose.inc ::: lines 643 ff.
else if ($COMPOSE['param']['body']) { $body = $COMPOSE['param']['body']; $isHtml = false; }
Is there a special reason for this behavior? I guess it is a bug. At least it prevents me to pre-define HTML compose bodies. If there is a special reason for this fallback to text bodies then please note that the HTML Editor select box is set accordingly; it is set accordingly to user's preference.
I have already contacted Alec and he replied:
"$COMPOSE['param']s in general are for text only, because they are URL parameters. If you want to inject any body use message_compose_body hook. Feel free to propose fix/better solution via pull request."
I think Alec is not right.
$COMPOSE['param'] is also set by the hook 'message_compose'. See ./program/steps/mail/compose.inc ::: lines 450 ff.
// pipe compose parameters thru plugins $plugin = $RCMAIL->plugins->exec_hook('message_compose', $COMPOSE); $COMPOSE['param'] = array_merge($COMPOSE['param'], $plugin['param']);
So, the simple solution to allow plugin developers to pre-define HTML bodies is:
./program/steps/mail/compose.inc ::: lines 643 ff.
else if ($COMPOSE['param']['body']) { $body = $COMPOSE['param']['body']; $isHtml = $COMPOSE['param']['html'] ? true : false; }