472,127 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

C# and Mail NewLine Character?

Hi,

Is there a way to construct the mail body including newline characters by
using .net framework mailing functions when sending an email? I cannot
insert newline character into the body of the mail.

Thanks...
Apr 12 '06 #1
5 6839
Can you not use System.Environment.NewLine?

Simon.

"Adam Right" <ad**@right.com> wrote in message
news:u2**************@TK2MSFTNGP05.phx.gbl...
Hi,

Is there a way to construct the mail body including newline characters by
using .net framework mailing functions when sending an email? I cannot
insert newline character into the body of the mail.

Thanks...

Apr 12 '06 #2
Hi,

I have used all newline characters such as Environment.NewLine, "\r\n",
StringBuilder.AppendLine(). But when the mail body string has contructed, it
contains only "\r\n". Ok it is normal, but when i send this string as a body
of the mail, it does not recognize '\r\n' as an newline character. I hope
you understand my case. Thanks...
"Simon Hart" <srhartone[no spam]@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Can you not use System.Environment.NewLine?

Simon.

"Adam Right" <ad**@right.com> wrote in message
news:u2**************@TK2MSFTNGP05.phx.gbl...
Hi,

Is there a way to construct the mail body including newline characters by
using .net framework mailing functions when sending an email? I cannot
insert newline character into the body of the mail.

Thanks...


Apr 12 '06 #3
If you're sending HTML mail (based on the MIME type of the message, not the
presence or lack of HTML tags), then the mail reader will ignore whitespace
including newline. To test this, try replacing the newline with "<br />"
and see what impact that has on your results.

"Adam Right" <ad**@right.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

I have used all newline characters such as Environment.NewLine, "\r\n",
StringBuilder.AppendLine(). But when the mail body string has contructed,
it contains only "\r\n". Ok it is normal, but when i send this string as a
body of the mail, it does not recognize '\r\n' as an newline character. I
hope you understand my case. Thanks...
"Simon Hart" <srhartone[no spam]@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Can you not use System.Environment.NewLine?

Simon.

"Adam Right" <ad**@right.com> wrote in message
news:u2**************@TK2MSFTNGP05.phx.gbl...
Hi,

Is there a way to construct the mail body including newline characters
by using .net framework mailing functions when sending an email? I
cannot insert newline character into the body of the mail.

Thanks...



Apr 12 '06 #4
Hi,

Is there an option to send mail in HTML format in C# mailing functions?
Thanks...

"Kyle M. Burns" <so*****@nospam.com> wrote in message
news:eT**************@TK2MSFTNGP03.phx.gbl...
If you're sending HTML mail (based on the MIME type of the message, not
the presence or lack of HTML tags), then the mail reader will ignore
whitespace including newline. To test this, try replacing the newline
with "<br />" and see what impact that has on your results.

"Adam Right" <ad**@right.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

I have used all newline characters such as Environment.NewLine, "\r\n",
StringBuilder.AppendLine(). But when the mail body string has contructed,
it contains only "\r\n". Ok it is normal, but when i send this string as
a body of the mail, it does not recognize '\r\n' as an newline character.
I hope you understand my case. Thanks...
"Simon Hart" <srhartone[no spam]@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Can you not use System.Environment.NewLine?

Simon.

"Adam Right" <ad**@right.com> wrote in message
news:u2**************@TK2MSFTNGP05.phx.gbl...
Hi,

Is there a way to construct the mail body including newline characters
by using .net framework mailing functions when sending an email? I
cannot insert newline character into the body of the mail.

Thanks...



Apr 13 '06 #5
Take a look at the BodyFormat property of the MailMessage class.

"Adam Right" <ad**@right.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi,

Is there an option to send mail in HTML format in C# mailing functions?
Thanks...

"Kyle M. Burns" <so*****@nospam.com> wrote in message
news:eT**************@TK2MSFTNGP03.phx.gbl...
If you're sending HTML mail (based on the MIME type of the message, not
the presence or lack of HTML tags), then the mail reader will ignore
whitespace including newline. To test this, try replacing the newline
with "<br />" and see what impact that has on your results.

"Adam Right" <ad**@right.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

I have used all newline characters such as Environment.NewLine, "\r\n",
StringBuilder.AppendLine(). But when the mail body string has
contructed, it contains only "\r\n". Ok it is normal, but when i send
this string as a body of the mail, it does not recognize '\r\n' as an
newline character. I hope you understand my case. Thanks...
"Simon Hart" <srhartone[no spam]@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Can you not use System.Environment.NewLine?

Simon.

"Adam Right" <ad**@right.com> wrote in message
news:u2**************@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> Is there a way to construct the mail body including newline characters
> by using .net framework mailing functions when sending an email? I
> cannot insert newline character into the body of the mail.
>
> Thanks...
>



Apr 13 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by 3strands | last post: by
reply views Thread by Adam Right | last post: by
6 posts views Thread by Daniel Mark | last post: by
reply views Thread by Gary Josack | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.