• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1340
  • Last Modified:

Storing New line character in SQL server 2005 and sending emails from C#.

I am storing the Email body in Sqlserver 2005 database and it needs to be sent in as text Email. I want some newline characters in the email body. I tried few characters but does not seem to be working.
Following is what I tried : \r\n, char(13)+char(10), char(10)+char(13).
Any help is highly ppreciated.
Thanks
0
Faye_DBA
Asked:
Faye_DBA
2 Solutions
 
shakashicoCommented:

MailMessage xx = new MailMessage();
xx.BodyFormat = MailFormat.Html;
xx.Body = "scscscs <br/> ";
0
 
Faye_DBAAuthor Commented:
I cannot have xx.BodyFormat = MailFormt.HTML, it has to be HTML.text only.
So this solution will not work for me.
Anyways I found the solution :
when creating message body in sqlserver insert as

insert into table_name (body)
values ('this is First Line'+char(13)+char(10)+'this is Second Line')

C# will automatically get the newline set between the two lines when it fetches the data from SqlServer.
thanks

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now