Page 3 of 5

Re: I've used this code to allow html system messages

PostPosted: 11:17pm, Thu 06 Nov, 2008
by Guest
mmalists01 wrote:
--------------------------------------------
Update -- this is crazy -- I have been importing my emails with the "import emails with different values for attributes." option since I want to include each person's location. I tried an import with just email address, using the "import emails with the same values for attributes." option, and lo and behold, the confirmation email is perfect. So what's going on that the one confirmation doesn't strip the \s, but the other does. :?: I guess I'm going to have to go ahead with just email addresses.


I can confirm that I have exactly the same problem in 2.10.7

Seems like the addition of a "stripslashes" got missed somewhere... I'm looking and will report back.

Steve

Re: I've used this code to allow html system messages

PostPosted: 11:51pm, Thu 06 Nov, 2008
by Guest
WOOOOOHOOOOOO! Found it! mmalist01 pay attention! This one is for you :D

sweigold wrote:
I can confirm that I have exactly the same problem in 2.10.7

Seems like the addition of a "stripslashes" got missed somewhere... I'm looking and will report back.


This is exactly what is going on. The import of differing attributes is handled by

lists\admin\commonlib\pages\importcsv.php

In that file buried deep in the tree long about line 660 you'll find the wayward subscribe message. Give it the same stripslashes treatment used elsewhere.

Here's my modified code.


Code: Select all
        if (!TEST && $_SESSION["notify"] == "yes" && $addition) {
          $subscribemessage = ereg_replace('\[LISTS\]', $listoflists, getUserConfig("subscribemessage", $userid));
          $subscribemessage = stripslashes($subscribemessage); // Needed so html email will display properly; ie converts " to "
          if (function_exists('sendmail')) {
            sendMail($user["systemvalues"]["email"], getConfig("subscribesubject"), $subscribemessage, system_messageheaders(), $envelope);
            if (isset ($_SESSION["throttle_import"])) {
              sleep($_SESSION["throttle_import"]);
            }
          }
        }


PostPosted: 11:52pm, Thu 06 Nov, 2008
by Guest
Sorry... didn't know how to make the code look better :shock:

PostPosted: 12:12am, Fri 07 Nov, 2008
by Guest
sweigold wrote:Sorry... didn't know how to make the code look better :shock:


Who cares about looks ---- :wink:

Thanks for this -- my php skills are minimal and I would never have been able to work this out.

PostPosted: 3:58pm, Wed 12 Nov, 2008
by Guest
I've just successfully upgraded to v 2.10.7 and everything appears to work perfectly except for the HTML E-Mail which is sent to users when they request their Personal Location - it remains in text since the HTML slashes are not being stripped. All other system messages e.g Confirmation/Unsubscribe are formatted fine.

I've done all the configuration in index.php admin/subscribelib2.php and admin/lib.php as suggested.

Any ideas?

PostPosted: 4:03pm, Wed 12 Nov, 2008
by Guest
I've just successfully upgraded to v 2.10.7 and everything appears to work perfectly except for the HTML E-Mail which is sent to users when they request their Personal Location - it remains in text since the HTML slashes are not being stripped. All other system messages e.g Confirmation/Unsubscribe are formatted fine.

I've done all the configuration in index.php admin/subscribelib2.php and admin/lib.php as suggested on the forum.

Any ideas?

PostPosted: 4:22pm, Wed 12 Nov, 2008
by Guest
The post on the first page of posts from RJC covers that, but you already said you made the changes to admin/subscribelib2.php. Two possibilities: one... you missed something, or two, it doesn't work in 2.10.7. I'm using 2.10.7 and I made all the changes, but I don't recall testing the personal information fix. I'll check my installation and post back.

Steve

PostPosted: 4:32pm, Wed 12 Nov, 2008
by Guest
Nope... broke here too. I'll see if I can find it.

Steve

PostPosted: 5:07pm, Wed 12 Nov, 2008
by Guest
Found it! (wooohooo, thats two for two :D )

in index.php at about line 135, look for:

Code: Select all
sendMail ($uid[1],getConfig("personallocation_subject"),getUserConfig("personallocation_message",$uid[2]),system_messageheaders(),$GLOBALS["envelope"]);


In one fell swoop, this line gets the subject, gets the desired config email and sends it out. If we slow things down a bit, we can sneak in the necessary stripslashes. Comment out the above line of code, and put this in its place:

Code: Select all
$personallocmessage = getUserConfig("personallocation_message",$uid[2]);
$personallocmessage = stripslashes($personallocmessage);
sendMail ($uid[1],getConfig("personallocation_subject"),$personallocmessage,system_messageheaders(),$GLOBALS["envelope"]);


Seems to work for me. I didn't do a lot of testing though so YMMV.

Steve

PostPosted: 9:11am, Thu 13 Nov, 2008
by Guest
Steve it works perfectly - thanks for your efforts I now have a perfect installation!

Much appreciated.

Kevin

PostPosted: 3:35pm, Thu 13 Nov, 2008
by Guest
cable24 wrote:Steve it works perfectly - thanks for your efforts I now have a perfect installation!

Much appreciated.

Kevin


Glad to help Kevin. Thanks for mentioning it. I'm actually very new to PHP and newer still to PHPList so I'm glad and even kind of excited to be able to give back to the group so quickly.

Steve

Re: [mod] Confirmation emails in HTML format

PostPosted: 1:22pm, Sat 11 Jul, 2009
by rjc
Just for completeness (because in my original post, I didn't list ALL the changes needed; even though I found them all, I didn't list every file on the forums. Sorry to all those who had to find them themselves), and the fact that html system emails should be standard for phplist (which I think they are still not)...

Changes made to allow System Emails to contain html

(Version 2.10.10) - It seems that this is still needed

Make changes suggested by EvilPuppetMaster first (repeated here for completeness):

In admin/lib.php

AFTER:

Code: Select all
$destinationemail = '';


WITH:

Code: Select all
  // customisation to allow HTML in system messages
  $html_message = $message;
  $message = preg_replace('/(<script.*\/script>)|(<style.*\/style>)/i', '', $message);
  $message = preg_replace('/<a\s*.*?href\s*=\s*("|\')([^"\']*?)("|\').*?>(.*?)<\/a>/i', "$4:\n$2\n", $message);
  $message = strip_tags($message);
  // end customisation



Then perform RJC changes:

IN admin/subscribelib2.php

AFTER:
Code: Select all
$subscribemessage = ereg_replace('\[LISTS\]', $lists, getUserConfig("subscribemessage:$id",$userid));


ADD:
Code: Select all
$subscribemessage = stripslashes($subscribemessage);            // Needed so html email will display properly; ie converts \" to "


BEFORE:
Code: Select all
print '<title>'.$GLOBALS["strPreferencesTitle"].'</title>';


ADD:
Code: Select all
$message = stripslashes($message);            // Needed so html email will display properly; ie converts \" to "


IN index.php

AFTER:
Code: Select all
$confirmationmessage = ereg_replace('\[LISTS\]', $lists, getUserConfig("confirmationmessage:$id",$userdata["id"]));


ADD:
Code: Select all
$confirmationmessage = stripslashes($confirmationmessage);            // Needed so html email will display properly; ie converts \" to "


AFTER:
Code: Select all
$unsubscribemessage = ereg_replace("\[LISTS\]", $lists,getUserConfig("unsubscribemessage",$userid));


ADD:
Code: Select all
$unsubscribemessage = stripslashes($unsubscribemessage);            // Needed so html email will display properly; ie converts \" to "


REPLACE:
Code: Select all
sendMail ($uid[1],getConfig("personallocation_subject"),getUserConfig("personallocation_message",$uid[2]),system_messageheaders(),$GLOBALS["envelope"]);


WITH:
Code: Select all
// RJC MODIFIED - Needed so html email will display properly; ie converts \" to "
$personallocmessage = getUserConfig("personallocation_message",$uid[2]);
$personallocmessage = stripslashes($personallocmessage);
sendMail ($uid[1],getConfig("personallocation_subject"),$personallocmessage,system_messageheaders(),$GLOBALS["envelope"]);
// END RJC MODIFIED


IN admin/import1.php

AFTER:
Code: Select all
$subscribemessage = ereg_replace('\[LISTS\]', $listoflists, getUserConfig("subscribemessage",$userid));


ADD:
Code: Select all
$subscribemessage = stripslashes($subscribemessage);            // Needed so html email will display properly; ie converts \" to "


IN admin/import3.php

AFTER:
Code: Select all
$subscribemessage = ereg_replace('\[LISTS\]', $listoflists, getUserConfig("subscribemessage",$userid));


ADD:
Code: Select all
$subscribemessage = stripslashes($subscribemessage);            // Needed so html email will display properly; ie converts \" to "


IN admin/reconcileusers.php

BEFORE:
Code: Select all
logEvent($GLOBALS['I18N']->get('Resending confirmation request to')." ".$userdata["email"]);


ADD:
Code: Select all
$subscribemessage = stripslashes($subscribemessage);            // Needed so html email will display properly; ie converts \" to "


IN admin/commonlib/pages/importcsv.php

AFTER:
Code: Select all
$subscribemessage = ereg_replace('\[LISTS\]', $listoflists, getUserConfig("subscribemessage", $userid));


ADD:
Code: Select all
$subscribemessage = stripslashes($subscribemessage);            // Needed so html email will display properly; ie converts \" to "

Re: [mod] Confirmation emails in HTML format

PostPosted: 9:52pm, Fri 18 Sep, 2009
by endjo
Hmmm not working for me ..... !

Re: [mod] Confirmation emails in HTML format

PostPosted: 11:18pm, Wed 14 Oct, 2009
by eyemagic
Any luck with this in v2.10.10? Doesn't seem to be working...

Re: [mod] Confirmation emails in HTML format

PostPosted: 9:02am, Mon 16 Nov, 2009
by sardos
me neither :-(

followed the instructions to the letter...

can anyone help?