Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2011, 12:37 AM
Registered User
 
Join Date: Apr 2011
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Email linebreaks

Hi,

I didn't see this anywhere else on the forum.

I use godaddy as my host, when I send an email, I'd like to insert linebreaks.

for example:

Code:
myMessage.Body = "line 1..." & vbCrLF & "line 2..." & vbCrlf & "line 3..."
When the email is sent, the text shows fine, but the linebreaks are not inserted. I've also tried controlchars.newline, system.environment.newline and controlchars.crlf instead of the vbCrLf.

Besides reading a template from a text file, and then replacing the ##keyword##, as done on pg 324-325, is there a way to show the line breaks in the message?

My reason for doing this is, on my contactme.aspx, I have a name, phone number and textbox field that i read directly into the message body.

Thanks!
 
Old April 19th, 2011, 04:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The code you posted works for me, so I can think of only two reasons why this fails:

1. You're sending the message as HTML (IsBodyHtml is true) in which case you need to use an HTML <br /> tag.

2. Your client, such as Outlook is trying to be helpful and removes the line breaks when the message arrives.



Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 19th, 2011, 04:46 AM
Registered User
 
Join Date: Apr 2011
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the fast response. I did have the IsBodyHtml property set to true and didn't realize it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
email kirangentlebreeze1987 Visual Web Developer 2008 6 December 13th, 2009 01:21 AM
ignoring/skipping returns (linebreaks) TPP XSLT 2 November 22nd, 2006 02:59 PM
Linebreaks GabrielMobius Pro JSP 0 March 20th, 2006 03:23 PM
email keyvanjan Classic ASP Basics 2 March 20th, 2006 12:05 AM
System.Web.Mail - linebreaks possible? RPG SEARCH ASP.NET 1.0 and 1.1 Basics 9 January 29th, 2005 10:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.