HTML Formatting on Email

We’re using a web-client based in-house Servoy solution to track support tickets.

Our scenario is this.

We type a long response in a Text Area field. We write several paragraphs and use the return key to space them out.

Then we click a Servoy button that runs a method that takes what we typed and sends an email to the client.

In the process of building the email in the method, when it is received as an email, the field has removed all the returns and it shows just a big block of text… which is quite ugly.

What’s the trick to get the field to not do this in the code? Do I have to run a filter that converts return characters to
tags? Or is there a better trick?

		var emailBody = "The PayGo Help Team has responded to your Help Request." + "

" +
					
						"Your original ticket description:" + "

" +
						"<---------------------------------------Start---------------------------------------------->"+ "

" +
						"Date Submitted: " + dateSubmit + "
" +
						"Customer: " + customerName + "
" +
						"User: " + nickName + "
" +
						"Priority: " + priorityType + "
" +
						"Request Type: " + requestType + "

" +
						"Subject:" + "

" +
						forms[frm].ticket_subject + "

" +
						
						"Request Details:" + "

" +
						forms[frm].ticket_details + "

" +	
						"<----------------------------------------End----------------------------------------------->"+ "

" +				
						
						
						"Our Response: " + "

" +
						"<---------------------------PayGo Answer Starts Here---------------------------------->"+ "

" +
						tickets_to_ticket_notes_$active.body + "

" +
						"Thank you so much for being a customer.  Please respond to this ticket by logging into the PayGo Help System OR simply reply to this email leaving the subject line unaltered." + "

" +
						"http://paygopos.com/help/" + "

" +
						"<----------------------------PayGo Answer Ends Here----------------------------------->"+ "

" +					
						"Sincerely, " + "

" +
						"The PayGo Help Team"
		
		
		var emailSubject = 'Your PayGo Help Ticket Has Been Updated: Ticket: ' + forms[frm].id

		var msgText = emailBody;
		if (emailAddress2)
		{
			var success = plugins.mail.sendMail(emailAddress, 'PayGo Help <help@paygosaas.com>', emailSubject, '<html>' + msgText + '</html>', emailAddress2 );
		}
		else
		{
			var success = plugins.mail.sendMail(emailAddress, 'PayGo Help <help@paygosaas.com>', emailSubject, '<html>' + msgText + '</html>');			
		}

We are on Servoy 4.1.6.

Thanks.

Chico

You could try using a html table.

regards

Thanks for replying Peter… but I’m not sure what you mean.

This is what fixed it…

utils.stringReplace(emailBody, '\n', '
')

Something like:

emailBody = ‘’;
emailBody += ‘

’;
emailBody += ‘’;
emailBody += ‘’;
emailBody += ‘’;
emailBody += ‘';
.
.
.
emailBody += ';
emailBody += ‘
The PayGo Help Team has responded to your Help Request.
Your original ticket description:
<---------------------------------------Start---------------------------------------------->
Date Submitted: ’ + dateSubmit +’
The PayGo Help Team
’;