Create new line CU400

rsfairbanks
Member Posts: 107
Hello,
I am using Code Unit 400 SMTP Mail and filling the message body, but I am not sure how to create a carriage return.
Example:
I am going though the sales order lines adding the item and quantity using the appendbody function, but I want each sales order line to appear on a new line of the email.
Any ideas please?
Sorted - used html - the answer always comes after you have asked a silly question :oops:
Mr Moderator: You are welcome to delete this posting!
I am using Code Unit 400 SMTP Mail and filling the message body, but I am not sure how to create a carriage return.
Example:
I am going though the sales order lines adding the item and quantity using the appendbody function, but I want each sales order line to appear on a new line of the email.
Any ideas please?
Sorted - used html - the answer always comes after you have asked a silly question :oops:
Mr Moderator: You are welcome to delete this posting!
0
Answers
-
-
I have a strange bug with this that I cant put my finger on.
I have done exactly what was stated here and it works great. The return character enters.
However I am doing this in a REPEAT UNTIL loop with two lines. The first code line adds a line to the email and the second code line adds the character return.
However after about 30 lines the character return just stops working, meaning the email that is sent has all my lines of text in 30 lines then one big paragraph at the end.0 -
SmtpMail.CreateMessage(EMAIL05, EMAIL06, EMAIL06, EMAIL05, '', FALSE); SmtpMail.AddBCC(EMAIL09); ReturnChar := 13; IF SharedItem.FINDSET THEN REPEAT PriceChange := ABS(SharedItem."Unit Price" - SharedItem."Old Price"); SmtpMail.AppendBody(SharedItem."Item No." + ' ' + FORMAT(PriceChange); SmtpMail.AppendBody(FORMAT(ReturnChar)); UNTIL SharedItem.NEXT = 0; SmtpMail.Send;
Whether I receive this email in Outlook itself, or outlook over the web the result is the same. If I copy and paste the whole text block into WORD or notepad the result is the same.
Basically I get a long list as expected and then suddely at a point around 30 lines down the result looks like the line:SmtpMail.AppendBody(FORMAT(ReturnChar));
has just stopped working, giving me a big paragraph.0 -
Just from the top of my head ... try this:
SmtpMail.CreateMessage(EMAIL05, EMAIL06, EMAIL06, EMAIL05, '', FALSE); SmtpMail.AddBCC(EMAIL09); LineFeed := 10; CarriageReturn := 13; IF SharedItem.FINDSET THEN REPEAT PriceChange := ABS(SharedItem."Unit Price" - SharedItem."Old Price"); SmtpMail.AppendBody(SharedItem."Item No." + ' ' + FORMAT(PriceChange); SmtpMail.AppendBody(FORMAT(CarriageReturn) + FORMAT(LineFeed)); UNTIL SharedItem.NEXT = 0; SmtpMail.Send;
"CarriageReturn" and "LineFeed" are variables with datatype "Char".0 -
I tried that exact change and it made no difference.
However as I tested it so soon after it ran normally in my scheduler there was only a few entries in the email this time. 10 to be exact. This time the problem occoured after the 2nd line. So lines 3 to 10 were all in one big paragraph.
Seems to be something to do with being near the end of the list, and nothing to do with long lists etc.0 -
Yes, this process used to write to a text file and I have just moved it into a mail. In the test file the issue never occured.
Weird huh?0 -
Not sure if this is still a problem for the author, but I was having the exactly same issue, and I found out that Outlook was the one, sneaky, removing the "Extra Line Breaks".... So it was making that weird junk paragraph at the end of the list.Marcelo Borges
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions