Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 dbmail and HTML Format

Author  Topic 

wldodds
Starting Member

20 Posts

Posted - 2010-07-29 : 19:33:36
I'm trying to clean up an email body so that the recipient has the context looking nicer than simply a text file. I'm not an HTML type person so not really sure what the context of the body should look like in order to simply put line breaks at the right spots.

Here is an example of the sql text version which works:
set @EmailBody = 'Your ' + @Sales_Doc_Type + ' has been shipped and is in the "' + rtrim(@SalesBatch) + '" queue. '+ CHAR (13) + CHAR (13) + CHAR (10)+
'Order Number: '+ @Sales_Doc_Num + CHAR (13) + CHAR (10) +
'Account Number: ' + @Customer_Num + CHAR (13) + CHAR (10) +
'Account Name: ' + @Customer_Name + CHAR (13) + CHAR (10) +
'Order Amount: ' + '$ '+ Convert(varchar (20), Convert(money, @Total),1) + CHAR (13) + CHAR (10) +
'Waybill Numbers: ' + @Waybill_List + CHAR (10)

Here is what I want the results to look like via text dbmail:

Your Order has been shipped and is in the "READY TO BILL" queue.

Order Number: OREQP0000596
Account Number: 0000000006
Account Name: MARITIME CELLULAR
Order Amount: $ 245.00
Waybill Numbers: 1zh932408923409

So if I want to use @body_format = 'HTML' how do I get the carriage return on the lines in the set @EmailBody?

CSears
Starting Member

39 Posts

Posted - 2010-08-31 : 14:24:27
<br /> is the standard HTML page break if you are looking for a larger space in between (for example between line 1 and 2 of text). If you are just looking to have a carriage return, I know it can be attained by using:

quote:

set @EmailBody = @EmailBody + '
'



Note quite as clean but it will get the job done.

Go to Top of Page
   

- Advertisement -