Go!
 
 
May 16, 2008, 05:26:32 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Text email not stripping html tags  (Read 2875 times)
crandaddy
Newbie
*
Offline Offline

Posts: 13


View Profile
« on: July 06, 2007, 11:39:18 PM »

Hello, I'm just starting to use the 1.5beta2 newsletter component. I'm really liking it so far. However, I am having trouble with the text email.

Whenever I send out the preview, the text email that I get includes all of the html tags in it, including the html tags for the table items that the core.php mambot creates for each article.

Is there a way to have the html tags stripped out for the text email version?

It is very hard to read otherwise.

Thanks and thanks for the great component.
Don
Logged
Adam
Administrator
Hero Member
*****
Offline Offline

Posts: 4.253



View Profile WWW
« Reply #1 on: July 07, 2007, 11:03:48 AM »

the preview will send out two versions (one in text only format, and one in html format)
when editing a mailing, you can define two version, a text only version and an html version (on has an editor, the other doesn't)

if you enter regular text in that text field, it should send out in regular format (at least.. that's what it does for me)
Logged

- Joomla developer -

IMPORTANT: http://www.joomla-addons.org/option,com_smf/Itemid,7/topic,1332.0.html
Do not send support requests by PM. Post on the forum in stead.
crandaddy
Newbie
*
Offline Offline

Posts: 13


View Profile
« Reply #2 on: July 07, 2007, 01:00:25 PM »

Adam,
thanks for your reply. When I set up the mailing, I enter the text in both the html and the text areas and it is basically something like:

Dear [NAME],

[CONTENT:1]

[CONTENT:2]

But when I do the preview, the html version looks great. But the text version includes a bunch of html tags such as:

<table border="0" cellspacing="0" cellpadding="0" class="contentpaneopen"><tr><td class="contentheading">Background</td></tr><tr><td><h2>Experience That Counts</h2>

where "Background" is the article title and the <h2>Experience That Counts</h2> is pulled directly from the article.

I'm trying to have it just include the article title and then strip any html from the article itself.

Is that possible?
Logged
Adam
Administrator
Hero Member
*****
Offline Offline

Posts: 4.253



View Profile WWW
« Reply #3 on: July 09, 2007, 10:29:31 AM »

aah ok.

that could be yeah. will have to look into that.
Logged

- Joomla developer -

IMPORTANT: http://www.joomla-addons.org/option,com_smf/Itemid,7/topic,1332.0.html
Do not send support requests by PM. Post on the forum in stead.
crandaddy
Newbie
*
Offline Offline

Posts: 13


View Profile
« Reply #4 on: July 10, 2007, 10:58:42 PM »

I think that I've figured out a solution. I don't know if it is the best one, but it looks like it works for me.

In the core.php mambot, in the function botContent I added a htmlspecialchars_decode() and strip_tags() functions around the AltBody (around line 368) so that it is:

$mailer->AltBody = htmlspecialchars_decode(strip_tags(preg_replace_callback($regex, 'botParseContent', $mailer->AltBody),'<a>'));

note that the htmlspecialchars_decode() only works with PHP5 >= 5.1.0 so leave that function off if you are on < PHP5.1

Then, to keep the title and the first line of the content from running together, in the function botParseContent somewhere around line 391 (the line with $row->title) and around line 402 (the line with _READ_MORE) I added a ."\n\n" to add a couple of carriage returns.

I included the '<a>' part for the strip_tags function so that at least some kind of link for Read More would show up. It does show the weblink but leaves the html for the <a href...> in there. Any suggestions from anyone on how to get around this would be greatly appreciated.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Joomla-addons.org © 2006 | www.bandhosting.nl | JCD-A Member | Newsletter | Sitemap |