I'm not sure if this is a mail_edit issue or date or subscriptions issue (this is related, but technically a different issue: http://drupal.org/node/416290).

I go to administer->site building->mail templates and configure the digest template to include a date.

When the date is printed in the digest email, it contains HTML tags, even though the user's account is configured to receive e-mail in plain text only:

Title: MPAA: Box Office Up 5.2%, Foreign Ticket Sales Dominate
<span class="date-display-single">04/01/2009</span>

TheWrap.com : Foreign now comprises 65 percent of the industry total -- an
increase of 17 percent over the last five years.

I uninstalled mimemail, but the date is still wrapped in these tags. Any ideas on how to remove these tags from the date printed in the digest?

Comments

salvis’s picture

You mean a cck date field?

subscriptions_cck.module uses the following code

          if (!($formatted = html_entity_decode( content_format($field_info, $value, 'plain'), ENT_QUOTES, 'UTF-8'))) {
            $formatted = content_format($field_info, $value, 'default');
          }

to try to retrieve the field data in 'plain' format. If nothing is returned, it then asks for the 'default' format. Please take this information to the queue of the cck module that supplies your date field and ask there, why you're getting the span tags.

somebodysysop’s picture

Title: HTML "span" tags on date tokens even when MimeMail is not installed » HTML coding in plain text emails

OK, it appears that the date field is being wrapped in html tags by default by the date.module.

However, I have a cck text field which contains quotation marks that appears in the same digest email as follows:

Now, instead  of just asking, &quot;How much are you offering?&quot; people browsing the 
booths at the Locations Trade Show 2009 -- which kicks off today at the Santa 
Monica Civic Auditorium and runs through Saturday -- must also ask, &quot;Is 
the money really there and am I going to get it in the end?&quot;

I know that the text is being entered in plain text format because I have disabled wysiwyg editor from this node field.

I posted this question in the cck forum along with the note from salvis @ #1 above. Here is the response I received:

The 'plain' formatter for a text field does a check_plain(), which encodes entities. Not sure why the wrapping html_entity_decode() does not detect them, but that should be fixed in the calling code.

So, this bounces me back here. Is there some reason why the subscriptions_cck.module code would html encode quotation marks in a cck textarea field that is marked as plain? No, that's not a good question. What reason is it that this cck text field entered as plain text is being html encoded even though mimemail is not installed and user account specifies plain text emails?

salvis’s picture

Always post links to other issues when you refer to them (or even better: move the issue back and forth). I'm past the age of hide and seek...

Let's take a step back and leave subscriptions_cck out of the picture for a moment. When you put quotes into a node title and body, are they encoded as entities or delivered as plain quotes?

user account specifies plain text emails

What's the URL of the page where you specify this?

somebodysysop’s picture

Sorry. I thought I had posted the relevant information here.

I posted this issue: http://drupal.org/node/436238 as a result of the advice @ #1 above. Originally the problem was with a cck date field. But, I realized that I had a similar problem (unwanted html encoding) with a cck text field.

We do not recall any problems with html encoding of node title and body. That is, the title and body of my nodes always appear correctly (no html encoding) in digests.

When mimemail.module is installed, it adds a setting in the user account to

receive emails in plain text only

: http://members.amptp.org/user/**uid**/edit

salvis’s picture

First hand information is always best. Keeping one problem in one issue and moving that issue between projects is an ingenious way of keeping all involved parties up-to-date and all information in one place.

We do not recall any problems with html encoding of node title and body. That is, the title and body of my nodes always appear correctly (no html encoding) in digests.

Do you not recall any problems or have you actually tested it?

I don't specifically distrust mimemail.module, but since the issue concerns mimemail.module's core business, the next logical step is to test whether you can get quotes and double-quotes past it.

somebodysysop’s picture

I have mimemail installed on another site that shares the problem site's code base (i.e., same versions of subscriptions, cck and date module). I just tested. So:

With mimemail installed: subscriptions digest represents quotation marks from title and body correctly.
With mimemail not installed: subscriptions digest represents quotation marks from title and body correctly.

The problem appears to be related to cck field values (date and text specifically) continuing to be html encoded when mimemail is not installed.

salvis’s picture

Ok, thanks. I'm waiting for a reply to #436238-3: HTML coding in plain text emails.

salvis’s picture

Would it help to pass the cck field values through the check_plain() function?

salvis’s picture

Status: Active » Closed (fixed)

@SomebodySysop: You closed #436238: HTML coding in plain text emails and haven't shown any interest in pursuing this any further, so let's close this as well.

somebodysysop’s picture

Sorry for the delayed response. It appears that this will require effort from the cck folks to fix, and they haven't shown any interest in that.

For people who may find themselves in the same boat, what I finally did was to configure the mails to be sent in plain text, but installed the htmlmail module. What this does is wrap the emails in tags. What that does, effectively, is to display the fields that are html encoded the way they should look (i.e., no tags displayed).

This is working.

Thanks for your help.