Email Body New Line

Discussion in 'ASP .Net Web Controls' started by Morris Neuman, Jun 30, 2009.

  1. Hi,

    I want the EmailBody to have new line between fields. Tried '\n' as well as
    "\n" but neither work.

    My string is as follows:
    string EmailBody = "Name=" + TextBox1.Text + '\n' + "Phone=" + TextBox2.Text
    + " Email=" + TextBox4.Text + " Message=" + TextBox3.Text + " Remote Host=" +
    RemoteHost;

    --
    Thanks
    Morris
    Morris Neuman, Jun 30, 2009
    #1
    1. Advertising

  2. Hi,

    I was able to get a new line using <br></br>

    string EmailBody = "Name=" + TextBox1.Text + "<br></br>" + "\n Phone=" +
    TextBox2.Text + " Email=" + TextBox4.Text + " ProductName=" + TextBox6.Text +
    " Message=" + TextBox3.Text + " Remote Host=" + RemoteHost;

    Is there another way?
    --
    Thanks
    Morris


    "Morris Neuman" wrote:

    > Hi,
    >
    > I want the EmailBody to have new line between fields. Tried '\n' as well as
    > "\n" but neither work.
    >
    > My string is as follows:
    > string EmailBody = "Name=" + TextBox1.Text + '\n' + "Phone=" + TextBox2.Text
    > + " Email=" + TextBox4.Text + " Message=" + TextBox3.Text + " Remote Host=" +
    > RemoteHost;
    >
    > --
    > Thanks
    > Morris
    Morris Neuman, Jun 30, 2009
    #2
    1. Advertising

  3. Hi Morris,

    >I was able to get a new line using <br></br>


    >string EmailBody = "Name=" + TextBox1.Text + "<br></br>" + "\n Phone=" +
    >TextBox2.Text + " Email=" + TextBox4.Text + " ProductName=" +

    TextBox6.Text +
    >" Message=" + TextBox3.Text + " Remote Host=" + RemoteHost;


    >Is there another way?



    This is the correct way to add a new line for HTML format. You could also
    wrap text in <p> to create a new paragraph:

    http://www.w3schools.com/html/tryit.asp?filename=tryhtml_paragraphs1

    Regards,
    Allen Chen
    Microsoft Online Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Allen Chen [MSFT], Jul 1, 2009
    #3
  4. OK Thanks.

    What about the \n? Why did that not work?
    --
    Thanks
    Morris


    "Allen Chen [MSFT]" wrote:

    > Hi Morris,
    >
    > >I was able to get a new line using <br></br>

    >
    > >string EmailBody = "Name=" + TextBox1.Text + "<br></br>" + "\n Phone=" +
    > >TextBox2.Text + " Email=" + TextBox4.Text + " ProductName=" +

    > TextBox6.Text +
    > >" Message=" + TextBox3.Text + " Remote Host=" + RemoteHost;

    >
    > >Is there another way?

    >
    >
    > This is the correct way to add a new line for HTML format. You could also
    > wrap text in <p> to create a new paragraph:
    >
    > http://www.w3schools.com/html/tryit.asp?filename=tryhtml_paragraphs1
    >
    > Regards,
    > Allen Chen
    > Microsoft Online Support
    >
    > Delighting our customers is our #1 priority. We welcome your comments and
    > suggestions about how we can improve the support we provide to you. Please
    > feel free to let my manager know what you think of the level of service
    > provided. You can send feedback directly to my manager at:
    > .
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
    >
    > Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 2 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions. Issues of this
    > nature are best handled working with a dedicated Microsoft Support Engineer
    > by contacting Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    > ==================================================
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    >
    Morris Neuman, Jul 1, 2009
    #4
  5. Hi Morris,

    >OK Thanks.


    >What about the \n? Why did that not work?


    \n is not recognized as a line break in HTML. The valid tag is <br>. We
    have to follow the HTML standard.

    http://www.w3schools.com/TAGS/tag_br.asp

    Regards,
    Allen Chen
    Microsoft Online Support
    Allen Chen [MSFT], Jul 2, 2009
    #5
  6. Hi Morris,

    >OK Thanks.


    >What about the \n? Why did that not work?


    Do you have additional questions? If you have please don't hesitate to let
    me know.

    Regards,
    Allen Chen
    Microsoft Online Support
    Allen Chen [MSFT], Jul 7, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugo
    Replies:
    10
    Views:
    1,288
    Matt Humphrey
    Oct 18, 2004
  2. London Boy
    Replies:
    2
    Views:
    310
    Keith Bowes
    Jan 12, 2004
  3. Lisa
    Replies:
    11
    Views:
    200
    Gunnar Hjalmarsson
    Dec 21, 2004
  4. Replies:
    5
    Views:
    193
    A. Sinan Unur
    Sep 8, 2005
  5. Replies:
    8
    Views:
    236
    Bart Van der Donck
    Nov 10, 2007
Loading...

Share This Page