Line feeds entered by the user not reflected in sent email

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

Line feeds entered by the user not reflected in sent email

#1

Postby Hovik » Wed Dec 19, 2007 1:33 pm

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.
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#2

Postby Hovik » Wed Dec 19, 2007 1:40 pm

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:

Code: Select all

set SUMMARY_EMAIL = replace&#40;SUMMARY,'\r\n', '<br>'&#41;;
0 x

Hovik
Moderator
Moderator
Posts: 184
Joined: Tue Sep 11, 2007 8:58 am

#3

Postby Hovik » Fri Dec 21, 2007 5:55 pm

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 23 guests