1
enzobond
send email with html to site members
  • 2006/2/9 17:18

  • enzobond

  • Just popping in

  • Posts: 4

  • Since: 2006/2/9 1


hi mates, how could i send html email to my sites's members to inform them, for example, about the last news? the XOOPS system function "mail users" appears not support html tags.

thanx in advance for the support

2
enzobond
Re: send email with html to site members
  • 2006/2/11 9:35

  • enzobond

  • Just popping in

  • Posts: 4

  • Since: 2006/2/9 1


that's possible that there's no way to send html emails to site members? any module?

3
enzobond
Re: send email with html to site members
  • 2006/2/21 17:27

  • enzobond

  • Just popping in

  • Posts: 4

  • Since: 2006/2/9 1


no help

4
ICHI_UK
Re: send email with html to site members
  • 2006/2/21 17:29

  • ICHI_UK

  • Not too shy to talk

  • Posts: 181

  • Since: 2005/11/1


evennews might help

5
tzvook
Re: send email with html to site members
  • 2006/2/28 14:15

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Evenews has problems with the 2.2.x series, and an option for site-wide mailer to send html enable mails will be great !
Actually I'm looking for the solutions for quite some time now and didn't got to it yet.

Maybe someone hacked it already and is willing to enlight our eyes ... ?

6
enzobond
Re: send email with html to site members
  • 2006/3/8 9:52

  • enzobond

  • Just popping in

  • Posts: 4

  • Since: 2006/2/9 1


any news about an html emailer for XOOPS 2.2.X ?

:(

7
nachenko
Re: send email with html to site members
  • 2006/3/20 15:07

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


I too want too know wether is possible or not to send HTML mails using XoopsMailer class.

Man, I really need XOOPS to do it.

8
tzvook
Re: send email with html to site members
  • 2006/3/20 16:46

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Hello All
Stop searching for one that does not exists, join us in this project
https://xoops.org/modules/newbb/viewtopic.php?post_id=210964&topic_id=47617&forum=30#forumpost210964

9
sceilig
Re: send email with html to site members
  • 2006/5/17 9:27

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


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.

I did a quick hack to allow me 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
Quote:

// private
var $contentType;


2. in the same file around line 209 (just above setSubject())
Quote:

// public
function setContentType($value)
{
if ($value) $this->contentType = trim($value);
}


3. in the same file around line 399 (just after ($this->encoding)
Quote:

$this->multimailer->ContentType = $this->contentType;


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/mailusers/mailusers.php

At line 157 (just after $xoopsMailer =& getMailer();)
add this lines:

Quote:

$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']));


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
Quote:

include_once XOOPS_ROOT_PATH . "/class/xoopseditor/inbetween/forminbetweentextarea.php";
$body_text = new XoopsFormInbetweenTextArea(array('caption'=> $body_caption, 'name'=>'description', 'value'=>$mail_body, 'width'=>'100%', 'height'=>'250px'),true));



I realise some other people on the forums are working on coming up with a full newsletter module but I needed a solution now rather than later for a website I was creating. I cant guarantee that the above code will cause problems somewhere along the line or if there is even a better approach. Most likely certain people using plain text email clients might have problems viewing emails, and also AOL users (html links need to be done a different way). If looking for a more solid approach you would have to hack the xoopsmailer further, and implement some other phpmailer calls
http://phpmailer.sourceforge.net/

It also wouldnt be that difficult to implement the above hack for the evennews module.

10
tzvook
Re: send email with html to site members
  • 2006/5/17 13:33

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


@ sceilig
10X for this usefull hack

One problems and 1 solution though:

at /system/admin/mailusers/mailform.php (line 82) your code gives a white screen, it should be:

include_once(XOOPS_ROOT_PATH "/class/xoopseditor/inbetween/forminbetweentextarea.php");
$body_text = (new XoopsFormInbetweenTextArea(array('caption'=> $body_caption'name'=>'description''value'=>$mail_body'width'=>'100%''height'=>'250px'),true));


rest is working good (html mails are being sent and inbetween is embeded) ... but the {X_MESSAGE} is not passing to the email itself ...

Edit
K ... Found it ... look at the next massage ...

Login

Who's Online

311 user(s) are online (249 user(s) are browsing Support Forums)


Members: 0


Guests: 311


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits