OK folks - tested with 2.3.3 and is working fine (I may add system-wide wysiwyg editor capability later on, but for now it works with TinyEditor/Inbetween which is my favorite by far)
I Took an old hack by sceilig with a few fixes and line corrections by me, and adopted it to XOOPS 2.3.3 with a few small changes (quoting a lot from the original thread) :
The XoopsMailer class builds upon the powerful phpmailer email class - this can be used to send emails as text, html or with multipart attachments.
The default setting for content-type in that class is "text/plain" which is why all XOOPS mails go out as text.
This is a quick hack to allow XOOPS to control the content-type setting per instance of using the XoopsMailer. So say for most emails being sent out (like forgot password, change email etc) they could appear as text, but if I wanted to have the "Mail Users" admin function send emails as html, I did the following hacks.
1. edit class/xoopsmailer.php and at line 96 (just above var $subject) add a contentType variable
// TZ added for HTML mailing //
// private
var $contentType;
// END TZ Addition //
2. in the same file around line 233 (just above setSubject())
// TZ added for HTML mailing //
// public
function setContentType($value)
{
if ($value) $this->contentType = trim($value);
}
// END TZ Addition //
3. in the same file around line 420 (just after ($this->encoding)
// TZ added for HTML mailing //
$this->multimailer->ContentType = $this->contentType;
// END TZ Addition //
4. Now depending on what module you are using for sending emails to users, you add a couple of fields to your $xoopsMailer instance.
e.g. for sending html emails using the main "Mail Users" administration function, edit this file:
modules/system/admin/mailusers/mailusers.php
At line 147 ( $xoopsMailer =& xoops_getMailer(); )
add this lines:
// TZ added for HTML mailing //
$xoopsMailer->setContentType("text/html");
$xoopsMailer->setTemplate('mailusers.tpl');
$xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
$xoopsMailer->assign('X_SITEURL', XOOPS_URL."/");
$xoopsMailer->assign('X_MESSAGE', $myts->oopsStripSlashesGPC($_POST['mail_body']));
// END TZ Addition //
What Im doing here is setting the ContentType to be text/html. Then using a mail template I created called 'mailusers.tpl'. This template (stored in language/english/mail_template/) is essentially a html file containing my website header and footer, as well as XOOPS placeholders for the content of the email (X_MESSAGE) and Name of the website.
This would be a simple example of that template:
Quote:
{X_MESSAGE}
-------------------------------------
Please do not reply to this message.
-------------------------------------
{X_SITENAME}
{X_SITEURL} =================================================================
5. Implement a html editor for creating the body of the email like inbetween or fckeditor.
For the "Mail Users" function, you would edit modules/system/admin/mailusers/mailform.php
then uncomment line 82 ($body_text = new XoopsFormTextArea ......)
and put this call to the Inbetween editor instead
// TZ added for HTML mailing //
include_once(XOOPS_ROOT_PATH . "/class/xoopseditor/inbetween/forminbetweentextarea.php");
$body_text = (new XoopsFormInbetweenTextArea(array('caption'=> $body_caption, 'name'=>'mail_body', 'value'=>$mail_body, 'width'=>'100%', 'height'=>'250px'),true));
// END TZ Addition //
for tinyeditor turn it into:
// $body_text = new XoopsFormTextArea($body_caption, "mail_body", "", 10);
// TZ added for HTML mailing //
include_once(XOOPS_ROOT_PATH . "/class/xoopseditor/tinyeditor/formtinyeditortextarea.php");
$body_text = (new XoopsFormtinyeditorTextArea(array('caption'=> $body_caption, 'name'=>'mail_body', 'value'=>$mail_body, 'width'=>'100%', 'height'=>'250px'),true));
// END TZ Addition //
NOW - a call to devs - I "cleaned the dust" after 3 years from the original thread, please !!! add it to the core !!!
I can't see my sites without this hack and am tired to apply it to each version that comes out - it a must have one and ... well enough said ...
as said b4 - If not intended to the core - I plan to add system-wide editors to this ...
For small to medium sites - this hack is upgrading the mail-users features quite nicely instead of a mailinglist.