question

Pavel Pawlowski avatar image
Pavel Pawlowski asked

Multi Line email body in Data Driven Subscription in SSRS 2008

Any body knows how to create a multi-line email body in Data Driven Subscription in SSRS 2008? The body of email created form the Comment parameter of the Data Driven Subscription, unfortunately even the parameter is filled from a db field which contains multi-line data, all the CR-LF are removed from the text and text in the email arrives as one line(paragraph).
sql-server-2008ssrssubscriptions
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pavel Pawlowski avatar image
Pavel Pawlowski answered
As I wrote in my question. When you have a Data Driven Subscription in SSRS and when you choose email delivery, there is a field named Comment, which represents the body of the email. It is the message in the email and the report will be attached to this email. You can write a simple text into this field or choose a db field from the query used as source of the subscription. Problem is when you need a multi-line email with several articles in it (Need to explain what the report is and how to use it). Unfortunately SSRS always removed all the new-lines and put all the articles together as a single line. After several hours of playing with this I found, that you can put a HTML Source for this field and it will be put as the email body and then correctly showed by the email client :-) So you can use HTML code:

First article

Second atricle

You can use all the HTML features and the text is then correctly rendered in the client. At least in Outlook. **You have to put the HTML source into this field. :-)**
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

WilliamD avatar image WilliamD commented ·
You just have to make sure that the clients accept HTML emails (some people don't like this) it shouldn't be a problem for internal reporting though.
0 Likes 0 ·
Pavel Pawlowski avatar image Pavel Pawlowski commented ·
Yeah, right. I wrote, that in Outlook it works correctly.. And I have to send an email with several articles, describing the report and how to use it. Better HTML than a mess of all the articles combined together into single line without any format. :-)
0 Likes 0 ·
Fatherjack avatar image
Fatherjack answered
What CR-LF characters are they? I would try out different options - vbcrlf, Char(10), Char(13), etc etc.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pavel Pawlowski avatar image Pavel Pawlowski commented ·
@Fatherjack, I wrote CR-LF only to mention, that in the the string stored in db field there are new lines Char(10), Char(13). The new line are present, but when the field is passed in the Data Driven Subscription as Comment (email body), all the new lines in the text are removed and rendered as a single line.
0 Likes 0 ·
Fatherjack avatar image Fatherjack ♦♦ commented ·
@Pavel - yes, I appreciate your problem. You could try substituting the Char(10) Char(13) with the other linefeed characters to see if they pass thru the SSRS processing without 'damage'.
0 Likes 0 ·
WilliamD avatar image
WilliamD answered
Pavel - found this hiding in some awful multi-level forum/newsgroup type place - I am not sure if it works, but could be worth a try: =REPLACE(Fields!YourFieldHere.Value,CHR(10), vbcrlf)
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pavel Pawlowski avatar image Pavel Pawlowski commented ·
@WilliamD, It's not a problem of displaying multi-line field. The problem is in the Subscription. When you define Data Driven Subscription, select email delivery and report is rendered as Excel and there is also possible Specify Comment (it is email body - message which will be written in email). You can specify a static value, nothing or select a field from combo. You cannot specify such expression for this. Playing with for several hours and googled for this but didn't find anything. Found similar problems using Google but not answers, so tried to post it here. But Just about 15 minutes ago I found solution :-). Going to post it here. :-)
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.