Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
New Posts New Topics All Posts All Forums Index General Modules Themes Development International XOOPS.org

Search

Donat-O-Meter

Make donations with PayPal!
Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $65.00
Net Balance: $61.80
Left to go: $38.20

Donations
studioC  ($25)May-17
Anonymous ($15)May-16
Anonymous ($25)May-4

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

2 2.5 2.6 3.0 2013 Abuse adslight AntiHarvesting AntiMalUser AntiSpam API Australia Ban banner Beats billige black Blocks blue Captcha cell Christmas chronolabs content Conversion database demo docek download Dresses editor evden eve facebook Federated floor free Gateway herre Honeypot Human IP jQuery kantor lamps Legal log logger mobile module modules Monster MyAlbum-p Networks newbb news Notices online PageRank pdf Permissions pink Plugin portal Prevention profile project Protector publisher release Rights rmcommon Room sale security SERIAL Server site Smarty Spam statistics stem Studio tag tags tdmcreate template Theme themes userlog website Whitepaper XML XooLaT xoops Xoopspoll Xortify xthemes Yolande ZendFramework

New Users

Registering user

# 136012

carrie123

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post

(1) 2 »


#1 Posted on: 2008/11/19 17:15 Using HTML in Mail Users under System?
Can we use html code in the "body" when we mail all users? Mail users is in the system section on xoops. I tried it and it doesn't work, but maybe I am missing something. Thanks.

Top

Faustinah
Friend of XOOPS
Friend of XOOPS
Joined:
2007/5/8 0:29
From Colorado
Group:
Registered Users
Posts: 41
(Show More) (Show Less)


#2 Posted on: 2008/11/19 20:21 Re: Using HTML in Mail Users under System?
AFAIK it is only text and some listed tags. I think I have seen somewhere on this forum a patch to change the email message attribute from text to html.

Top


The art of asking questions.
ghia
Community Support Member
Community Support Member
Joined:
2008/7/3 14:19
From Belgium
Group:
Registered Users
Posts: 4946
(Show More) (Show Less)


#3 Posted on: 2009/3/26 8:18 Re: Using HTML in Mail Users under System?
Since this one : http://www.xoops.org/modules/newbb/vi ... id=289857#forumpost289857 is not working for me with 2.3.3 , I'll locate a 3 years old hack and try to make it work with the current version ....

This one should have long ago enter the core .... any email client support HTML , Sending your users text is ridiculous ...

All my 2.2.4 sites has this hack (slightly moded version), I'll be back with the solution - I hope

==================== edit ===============
Found it - send email with html to site members

I'll try and see if it works with 2.3.3 .... later today

Top


Gifts45.com - Gifts & Shopping Directory
inTHEtube.TV - The ultimate video experience
MBgallery - Official Facebook Pages
tzvook
Just can't stay away
Just can't stay away
Joined:
2003/2/1 17:15
From Israel
Group:
Registered Users
Posts: 843
(Show More) (Show Less)


#4 Posted on: 2009/3/26 9:37 Re: Using HTML in Mail Users under System?
Quote:
This one should have long ago enter the core

If it works, can you add it to "Feature Request"?

Thanks...

Top


Please support XOOPS & donate
Use 2.5.5 | Debugging | Requests | Bugs
Mamba
Moderator
Moderator
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 6936
(Show More) (Show Less)


#5 Posted on: 2009/3/26 11:01 Re: Using HTML in Mail Users under System?
Quote:

Mamba wrote:
Quote:
This one should have long ago enter the core

If it works, can you add it to "Feature Request"?

Thanks...


As you can read here
I asked this 3 years ago - and indeed - as I said b4 - all mail clients support HTML - it's a shame XOOPS is still so many years back with mailing users, this feature is just the "tip of the iceberg", but it's a start .

Anyway - I got home and am going to get it to work with 2.3.3 !!!

Top


Gifts45.com - Gifts & Shopping Directory
inTHEtube.TV - The ultimate video experience
MBgallery - Official Facebook Pages
tzvook
Just can't stay away
Just can't stay away
Joined:
2003/2/1 17:15
From Israel
Group:
Registered Users
Posts: 843
(Show More) (Show Less)


#6 Posted on: 2009/3/26 12:10 Re: Using HTML in Mail Users under System?
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:


<html>
<body>
<div style="margin-left: 20px; margin-right:20px;">
{X_MESSAGE}
<br />
<br />
-------------------------------------<br />
Please do not reply to this message.<br />
-------------------------------------<br/ >
<br />
{X_SITENAME}<br />
<A href='{X_SITEURL}'>{X_SITEURL}</a><br />
</div>
</body>
</html>

=================================================================

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.



Top


Gifts45.com - Gifts & Shopping Directory
inTHEtube.TV - The ultimate video experience
MBgallery - Official Facebook Pages
tzvook
Just can't stay away
Just can't stay away
Joined:
2003/2/1 17:15
From Israel
Group:
Registered Users
Posts: 843
(Show More) (Show Less)


#7 Posted on: 2009/3/26 13:36 Re: Using HTML in Mail Users under System?
Just a quick note !!!
If you use the PM option in the mail-users admin, you'll find out that you PM module is non-HTML enable.

There is a fix for that too, but, well, I simply recommend using "mpmanager" module instead of the (XXXXXX) pm module ... which solves the issue.

Top


Gifts45.com - Gifts & Shopping Directory
inTHEtube.TV - The ultimate video experience
MBgallery - Official Facebook Pages
tzvook
Just can't stay away
Just can't stay away
Joined:
2003/2/1 17:15
From Israel
Group:
Registered Users
Posts: 843
(Show More) (Show Less)


#8 Posted on: 2009/3/28 7:09 Using WYSIWYG in Mail-Users
BUMP !!!!

This time this one got to get into the core .... such a simple ... yet .... so needed addition ....

Yes - I know - there's a solution for turning all textarea into wysiwyg - that's the worst solution there is ....


Top


Gifts45.com - Gifts & Shopping Directory
inTHEtube.TV - The ultimate video experience
MBgallery - Official Facebook Pages
tzvook
Just can't stay away
Just can't stay away
Joined:
2003/2/1 17:15
From Israel
Group:
Registered Users
Posts: 843
(Show More) (Show Less)


#9 Posted on: 2009/3/29 19:11 Re: Using WYSIWYG in Mail-Users
Feature request added.

Very useful hack, tvzook. Thank you!

Top


Never let a man who does not believe something can be done, talk to a man that is doing it.
sailjapan
Moderator
Moderator
Joined:
2005/11/16 5:27
From Osaka
Group:
Registered Users
Posts: 1667
(Show More) (Show Less)


#10 Posted on: 2009/3/30 8:31 Re: Using WYSIWYG in Mail-Users
One more thing:

Since Wysiwyg is used to send mail, all links MUST BE absolute !!! orelse will lead to something like .../.../uploads/whatever ......
same regarding to embed photos ...

So - if you use TinyEditor - there's an old bug regarding the Absolute/relevant path ... the preferences at the admin is not working right.
My solution was to force absolute path all the time (I like it site-wide anyway from SEO point of view)

If you need it too - open /modules/tinyeditor/include/initcode.php
look for line 257

replace
if ($moduleConfig['tinyedrelurls'] == '0') {
            echo 
'relative_urls : "false",';
        } else {
            echo 
'relative_urls : "true",';
            echo 
'remove_script_host : "true",';
        }


With:
if ($moduleConfig['tinyedrelurls'] == '1') {
            echo 
'relative_urls : "false",';
        } else {
            echo 
'relative_urls : "false",';
            echo 
'remove_script_host : "false",';
        }

//            TZ commernted out and replaced with the above code
//        if ($moduleConfig['tinyedrelurls'] == '0') {
//            echo 'relative_urls : "false",';
//        } else {//            echo 'relative_urls : "true",';
//            echo 'remove_script_host : "true",';
//        }


That will do it ...

Now that FrankBlack is around again - hope he'll send some bug fixes to that great-great module ...

Top


Gifts45.com - Gifts & Shopping Directory
inTHEtube.TV - The ultimate video experience
MBgallery - Official Facebook Pages
tzvook
Just can't stay away
Just can't stay away
Joined:
2003/2/1 17:15
From Israel
Group:
Registered Users
Posts: 843
(Show More) (Show Less)




(1) 2 »



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]