Rosali wrote:
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.
I don't think there's a special reason for that. The compose parameters are extracted from urls like mailto:foo@bar.com?subject=Test&body=Hit+me
Thus assuming plain text makes sense. Then later we added the plugin hooks and didn't think any further... That's all.
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.
That's right, the message_compose_body will let you overwrite the compose mode.
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; }
Yup, I think it doesn't break anything if we add that here, too. Done in https://github.com/roundcube/roundcubemail/commit/e957bfe
Regards, Thomas