Carriage Returns in sent email

luminultra 01 Mar, 2008
Hi folks,

Great tool :woohoo:

Can't figure out one thing however. I'm using a custom email template - really, really simple - and I need to know how to change or format the message so that carriage returns '<br>' are translated to the HTML version of the message. Currently if a user enters line breaks in the message, they exist in the plain text code, but do not appear in the HTML version. This goes for the database (Field Titles) version as well.

OR, how could I tell ChronoForms to send emails in plain text?

Cheers! :laugh:

UPDATE: Found a solution on this forum. Took asnippet of code from someone else solution. Plugged it in, changed a word and it works:
 <?php
$textareas = array('about_us', 'locations', 'contact_us', 'services');
foreach ($textareas as $textarea) {
  $fields[$textarea] = nl2br($fields[$textarea]);
  if ( strlen($fields[$textarea]) > 75 ) {
    $fields[$textarea] = wordwrap($fields[$textarea], 75, "<br />"«»);
  }
}
?>


Perhaps this should be hard coded anyway with a switch to turn on and off?

Post edited by: luminultra, at: 2008/02/29 21:28<br><br>Post edited by: admin, at: 2008/02/29 23:31
luminultra 01 Mar, 2008
Oops, forgot to subscribe to be notified on replies. :whistle:
Max_admin 01 Mar, 2008
Glad you found it quickly and thanks for posting the solution here!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Jpatient 29 Nov, 2008
I found the same piece of coding, looking for a solution for the same problem (wanting to insert carriage returns in E-mail output), with only 1 textarea.
But I can't get it to work. I put the code in the HTML editor from the e-mail temlate tab. The code gets messed up when clicking "Update":

<?php
$textareas = array('about_us');
foreach ($textareas as $textarea) {
  $fields[$textarea] = nl2br($fields[$textarea]);
  if ( strlen($fields[$textarea]) > 75 ) {
    $fields[$textarea] = wordwrap($fields[$textarea], 75, "<br />"«»);
  }
}
?>

becomes:
<!--p $textareas = array('about_us'); foreach ($textareas as $textarea) {   $fields[$textarea] = nl2br($fields[$textarea]);   if ( strlen($fields[$textarea]-->
<p>75 ) { $fields[$textarea] = wordwrap($fields[$textarea], 75, "<br />"«»); } } ?></p>

What am I doing wrong?
Maybe I should inform you that I'm a strictly trial-and-error and cut-and-past type of guy who knows absolutely nothing about any type of code whatsoever.
Max_admin 30 Nov, 2008
Hi Jpatient,

turn off the email editor for this email template, this can be done in the "Email properties" box for THIS email, choose NO for "using email editor"

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Jpatient 02 Dec, 2008
Where do you find the time to answer all these Q's??

The option you mentioned is not shown in my e-mail properties box. Version: 3.0 J1.5 BETA 2.
Should I upgrade?

No hurry, please take care of you time management!
GreyHead 02 Dec, 2008
Hi Jpatient,

You should upgrade to ChronoForms v 3.0 stable as there are some bugs in the beta version that Max fixed in the stable release.

Bob
Jpatient 04 Dec, 2008
Max , Bob,
Will do.
Thx for your (as always) great help. I already recieved the official version after contributing.
This forum alone is worth the measly amount of money that was asked for Chronoforms!
Max_admin 04 Dec, 2008
Thank you!🙂 we are trying to help!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.