ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

No line breaks in Email Notifications

July 28, 2010 10:33am

Subscribe [4]
  • #1 / Jul 28, 2010 10:33am

    rt30000

    125 posts

    Recently we resolved HTML and Plain Text email issues on my server and it has been working great. I have noticed now, though, that the plain text notification emails do not have line breaks/word wrap working.

    Word wrap is enabled by default and the default email format is set to plain text. Word wrap/line breaks work in all plain text mails from the Communicate Form and some freeform forms I use, so I’m not sure why these email notifications do not retain them.

  • #2 / Jul 28, 2010 7:54pm

    Brandon Jones

    5500 posts

    rt30000, to clarify, emails not sent via Communicate are still exhibiting the problem?

  • #3 / Jul 28, 2010 8:17pm

    rt30000

    125 posts

    Emails sent via Communicate and Freeform templates work perfect in both HTML and Plain Text. Email notification templates such as when someone comments etc do NOT show retain breaks. These are in the design > templates > email notifications section if I recall (off the top of my head).

  • #4 / Jul 29, 2010 1:37am

    John Henry Donovan

    12339 posts

    rt30000,

    What version and build of EE are you using?
    What server environment do you have?
    Other than Freeform do you have any more third party add-ons?

  • #5 / Jul 29, 2010 2:26pm

    rt30000

    125 posts

    Hello,
    Running 2.1 on a Windows server. This thread lead us to the fix for the config and it seems to resolve all email sent from Communicate and all Freeform emails. I am not sure why the email notifications themselves have no line breaks. Yes, I have quite a few add-ons but none I would suspect of having an effect on this.

  • #6 / Jul 30, 2010 1:54am

    John Henry Donovan

    12339 posts

    rt30000,

    I am just pinging the dev team again to see if this fix you received is applicable to EE generated emails.

  • #7 / Aug 26, 2010 5:40pm

    Robin Sowell

    13255 posts

    rt30000, my apologies.  This one just got skipped!

    The fix should cover any emails going out.  I checked comments in particular- word_wrap is forced to TRUE and the line breaks should be consistent w/the site wide setting.

    Are you running the latest- and you still have the email.php file in your config folder- correct?  Double check a notification template you know is failing?  Double check that template- make sure the line breaks are all correct in there as well.

  • #8 / Aug 27, 2010 9:09am

    rt30000

    125 posts

    Not a problem, it happens. 😉

    As an example, the default Admin Notification of Comments template:

    You have just received a comment for the following channel:
    {channel_name}
    
    The title of the entry is:
    {entry_title}
    
    Located at: 
    {comment_url}
    
    Posted by: {name}
    Email: {email}
    URL: {url}
    Location: {location}
    
    {comment}

    ...comes through without line breaks (as do the other email notification templates if I recall). Communication form and Freeform emails all come through correctly.

    As for your questions: The site is running 20100720, word_wrap is enabled by default, default format is plain text, and yes the email.php is present in the config directory as it should be (created and placed there done by your devs).

  • #9 / Aug 27, 2010 5:30pm

    Robin Sowell

    13255 posts

    Well- that’s definitely not the problem.  Doing some tests on my install- will report back shortly.  It would be a good idea to go ahead and update to the latest- 2.1.0 build 20100810.  But I honestly don’t think that’s it.  I may change my mind if I can’t replicate a difference in the config value getting picked up.

  • #10 / Aug 30, 2010 12:16pm

    Robin Sowell

    13255 posts

    I should have spotted that wordwrap was the difference off the bat.  The dev team’s discussing a permanent fix, but for the short term you could try editing CI’s Email lib around line 982:

    function _build_message()
        {
            if ($this->wordwrap === TRUE  AND  $this->mailtype != 'html')
            {
                $this->_body = $this->word_wrap($this->_body);
            }
            else
            {
                $this->_body = str_replace(array("\r\n", "\n"), $this->newline, $this->_body);
            }

    I added on the ‘else’ bit.  What was happening- in word_wrap, it does some replacements of newlines w/the $this->newline var.  That doesn’t happen otherwise.  Since the frontend notifications set wordwrap to false- existing newlines weren’t transformed.

    I make no promises this is the final fix- I can see a couple of ways to approach it.  But for a quick fix here, it should get you going.

    Make sense?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases