473,396 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How do I create line breaks in a string to be passed to email app?

Hi,

I am trying to start my email app (in this case Eudora) with a
programatically generated email. However, Eudora does not seem to recognize
any of the ways I have tried to create line breaks.

I have tried "\n", "\r\n", and using the StringBuilder AppendLine() method
like this:

StringBuilder body = new StringBuilder(1024);

// AppendLine doesn't work
body.AppendLine("Thank you for registering!");

// Neither does this
body.Append(System.Environment.NewLine);
body.Append("Support Forums");
body.AppendLine();
body.Append("Please be sure that you have the latest version, ");

Process process = new Process();
process.StartInfo.FileName = "mailto:";
process.StartInfo.FileName += tbEmail.Text;
process.StartInfo.FileName += "?subject=GaugeGlow License Key";
process.StartInfo.FileName += "&b*********************@comcast.net";
process.StartInfo.FileName += "&body=";
process.StartInfo.FileName += body;

process.Start();

yet, when the email opens in the application, there are no line breaks at all.

Stick

Sep 13 '06 #1
6 10368
Stick,

You might want to try URL encoding the body part of the url. It might
work then.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Stick" <St***@discussions.microsoft.comwrote in message
news:69**********************************@microsof t.com...
Hi,

I am trying to start my email app (in this case Eudora) with a
programatically generated email. However, Eudora does not seem to
recognize
any of the ways I have tried to create line breaks.

I have tried "\n", "\r\n", and using the StringBuilder AppendLine() method
like this:

StringBuilder body = new StringBuilder(1024);

// AppendLine doesn't work
body.AppendLine("Thank you for registering!");

// Neither does this
body.Append(System.Environment.NewLine);
body.Append("Support Forums");
body.AppendLine();
body.Append("Please be sure that you have the latest version, ");

Process process = new Process();
process.StartInfo.FileName = "mailto:";
process.StartInfo.FileName += tbEmail.Text;
process.StartInfo.FileName += "?subject=GaugeGlow License Key";
process.StartInfo.FileName += "&b*********************@comcast.net";
process.StartInfo.FileName += "&body=";
process.StartInfo.FileName += body;

process.Start();

yet, when the email opens in the application, there are no line breaks at
all.

Stick

Sep 13 '06 #2
Stick,

I am not sure in this case, however that mostly the <brdoes help in some
case (if your text is used in the mail as html) would I try that in your
situation first.

Cor

"Stick" <St***@discussions.microsoft.comschreef in bericht
news:69**********************************@microsof t.com...
Hi,

I am trying to start my email app (in this case Eudora) with a
programatically generated email. However, Eudora does not seem to
recognize
any of the ways I have tried to create line breaks.

I have tried "\n", "\r\n", and using the StringBuilder AppendLine() method
like this:

StringBuilder body = new StringBuilder(1024);

// AppendLine doesn't work
body.AppendLine("Thank you for registering!");

// Neither does this
body.Append(System.Environment.NewLine);
body.Append("Support Forums");
body.AppendLine();
body.Append("Please be sure that you have the latest version, ");

Process process = new Process();
process.StartInfo.FileName = "mailto:";
process.StartInfo.FileName += tbEmail.Text;
process.StartInfo.FileName += "?subject=GaugeGlow License Key";
process.StartInfo.FileName += "&b*********************@comcast.net";
process.StartInfo.FileName += "&body=";
process.StartInfo.FileName += body;

process.Start();

yet, when the email opens in the application, there are no line breaks at
all.

Stick

Sep 13 '06 #3
I found this from the C# specification.

9.3.1 Line terminators

31 Line terminators divide the characters of a C# source file into lines.

32 new-line::

33 Carriage return character (U+000D)

34 Line feed character (U+000A)

35 Carriage return character (U+000D) followed by line feed character
(U+000A)

36 Next line character (U+0085)

37 Line separator character (U+2028)

38 Paragraph separator character (U+2029)

39 For compatibility with source code editing tools that add end-of-file
markers, and to enable a source file to be

40 viewed as a sequence of properly terminated lines, the following
transformations are applied, in order, to every

41 source file in a C# program:

42 . If the last character of the source file is a Control-Z character
(U+001A), this character is deleted.

43 . A carriage-return character (U+000D) is added to the end of the source
file if that source file is non-empty

44 and if the last character of the source file is not a carriage return
(U+000D), a line feed (U+000A), a line

45 separator (U+2028), or a paragraph separator (U+2029).

You can download it from:
http://msdn.microsoft.com/netframewo...r/default.aspx

if you wish. Good luck

chanmm
"Stick" <St***@discussions.microsoft.comwrote in message
news:69**********************************@microsof t.com...
Hi,

I am trying to start my email app (in this case Eudora) with a
programatically generated email. However, Eudora does not seem to
recognize
any of the ways I have tried to create line breaks.

I have tried "\n", "\r\n", and using the StringBuilder AppendLine() method
like this:

StringBuilder body = new StringBuilder(1024);

// AppendLine doesn't work
body.AppendLine("Thank you for registering!");

// Neither does this
body.Append(System.Environment.NewLine);
body.Append("Support Forums");
body.AppendLine();
body.Append("Please be sure that you have the latest version, ");

Process process = new Process();
process.StartInfo.FileName = "mailto:";
process.StartInfo.FileName += tbEmail.Text;
process.StartInfo.FileName += "?subject=GaugeGlow License Key";
process.StartInfo.FileName += "&b*********************@comcast.net";
process.StartInfo.FileName += "&body=";
process.StartInfo.FileName += body;

process.Start();

yet, when the email opens in the application, there are no line breaks at
all.

Stick

Sep 13 '06 #4
Cor,

"Cor Ligthert [MVP]" wrote:
Stick,

I am not sure in this case, however that mostly the <brdoes help in some
case (if your text is used in the mail as html) would I try that in your
situation first.
Yes, my first thought too, but didn't work.

Stick

Sep 13 '06 #5
Nicholas,

"Nicholas Paldino [.NET/C# MVP]" wrote:
You might want to try URL encoding the body part of the url. It might
work then.
Hmmmm. I did an MSDN search, but don't see that it is possible to set this
format with the class I'm using, and I'm not too sure how to do it another
way. But thanks for the idea.

Sep 13 '06 #6
Stick,

Use the static UrlEncode method on the HttpUtility class in the
System.Web namespace. You will have to add a reference to System.Web.dll to
do this as well.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Stick" <St***@discussions.microsoft.comwrote in message
news:73**********************************@microsof t.com...
Nicholas,

"Nicholas Paldino [.NET/C# MVP]" wrote:
> You might want to try URL encoding the body part of the url. It
might
work then.

Hmmmm. I did an MSDN search, but don't see that it is possible to set
this
format with the class I'm using, and I'm not too sure how to do it another
way. But thanks for the idea.

Sep 13 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: dan glenn | last post by:
Hi. I'm finding that if I have text entered into a <textarea ...> </textarea> in a form, and that text has leading blank lines (with no spaces or anything else), that when I retrieve the entered...
1
by: Bill | last post by:
I am downloading data from a website that displays it in a table $fp = fopen("a website page", 'r'); The following accesses the stream one <td> element at a time $myData = fgets($fp); Then I...
1
by: ChrisC | last post by:
Im having trouble removing line breaks from my c# string. Actually, im having trouble getting .Trim() to work properly, as it seems to count a string that has nowt but a break of some sort as not...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
9
by: jsummit | last post by:
I'm trying to parse a rather large string from a .txt file that breaks into 2 lines ( the string is a fixed-length string reaching 6694 characters) into a dataset using VB.net. The issues that I am...
5
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the...
2
by: caspardh | last post by:
i was trying to code a morse code decipherer which workd fine except that the .txt file that i was converting had linebreaks built in, i cant get python to ignore the line breaks and i cant find any...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.