Is there any method of retaining line feeds in text boxes? i.e when a user presses 'enter' for a line feed, for the line feed to be reflected in the constructed email, otherwise everything appears in one long line which causes problems with lengthy text.
The message contains html, so the email resource is configured to support html.
Line feeds entered by the user not reflected in sent email
Moderators: Jon, Steve, Ian, Dave
-
- Moderator
- Posts: 184
- Joined: Tue Sep 11, 2007 8:58 am
-
- Moderator
- Posts: 184
- Joined: Tue Sep 11, 2007 8:58 am
A line feed is represented by 2 characters: \r\n
\r is one char, represents carriage return
\n is one char, represents new line
When the email is NOT configured for html, these characters cause the desired effect in the sent email.
However, an email resource configured for html treats these as normal characters and NOT as line feed. You need to replace these by <br> for html email to look as intended.
Assuming that the ebase field to be included is called SUMMARY, here is a solution:
1. Create a new field called SUMMARY_EMAIL (same length as SUMMARY + twice the maximum number of line feeds expected)
2. Unmap the SUMMARY field from the email resource
3. Map SUMMARY_EMAIL to the email resource
4. In the EMAIL script, just before the email command, insert the following:
\r is one char, represents carriage return
\n is one char, represents new line
When the email is NOT configured for html, these characters cause the desired effect in the sent email.
However, an email resource configured for html treats these as normal characters and NOT as line feed. You need to replace these by <br> for html email to look as intended.
Assuming that the ebase field to be included is called SUMMARY, here is a solution:
1. Create a new field called SUMMARY_EMAIL (same length as SUMMARY + twice the maximum number of line feeds expected)
2. Unmap the SUMMARY field from the email resource
3. Map SUMMARY_EMAIL to the email resource
4. In the EMAIL script, just before the email command, insert the following:
Code: Select all
set SUMMARY_EMAIL = replace(SUMMARY,'\r\n', '<br>');
0 x
-
- Moderator
- Posts: 184
- Joined: Tue Sep 11, 2007 8:58 am
2 points to add:
- The line feed is represented by 2 characters: \r\n in Windows (may be different in other operating systems)
Behaviour described in earlier post applies to versions of Ebase before 3.4.0
From Version 3.4.0, a 'carriage return+Line feed' character is replaced by '<br>' automatically, when contained within an html enabled email message.
0 x
Who is online
Users browsing this forum: No registered users and 14 guests