vbcrlf not working on aspx page

I have the following code snippet within a aspx page.  I want the text to be on two lines.  I have seemed to have tried everything to get this to do a vbcrlf.  Here is the lastest attempt.  Can anyone tell me why it doesnt work and how to make it work.  I have used vbcrlf instead and still everything is on the same line.



<head>
<script type="VB" runat="server" > 
 
Sub submit(s As Object, e As EventArgs) 
	
	SendConfirmation
	
End Sub 
Private Function SendConfirmation()
	dim message as string
	Dim nl As String = "%0D%0A"
	dim objMail as new mailmessage()
	message = "Your email message has been received and you will receive a response shortly" & nl & "Thank You for contacting TheApartmentGallery.com"
	objmail.to = txtemailaddress.text
	objmail.from = "Webmaster@theapartmentgallery.com"
	objmail.subject = "Auto Response From the Apartment Gallery"
	objmail.body = message
	objmail.cc = "bkatherman@theapartmentgallery.com"
	smtpMail.send(objMail)
  	SERVER.EXECUTE("sent.aspx")
 
End Function

Open in new window

mgmhicksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PaulHewsCommented:
In HTML, you indicate a new line using <br />

message = "Your email message has been received and you will receive a response shortly.<br />Thank You for contacting TheApartmentGallery.com"
0
cmcawoodCommented:
Have u tried
message = "Your email message has been received and you will receive a response shortly" & vbCrLf & "Thank You for contacting TheApartmentGallery.com"
	

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PaulHewsCommented:
Sorry, it's a mail message...  You need to enter real line break instead of URL encoding it.

message = "Your email message has been received and you will receive a response shortly" & Environment.NewLine() & "Thank You for contacting TheApartmentGallery.com"




0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

PaulHewsCommented:
If that fails, then you would need to use

objmail.BodyFormat = MailFormat.Html

and encode the line as

message = "Your email message has been received and you will receive a response shortly<br />Thank You for contacting TheApartmentGallery.com"

The thing is that many SMTP servers will disallow hard line breaks in text format.


0
daveamourCommented:
Also watch out for Outlook removing line breaks - look at the top of the message to check this.
0
mgmhicksAuthor Commented:
this code is wrapped around the <script type="VB" runat="server" > script.  So its in vb code.  No of the suggestions have worked.  I am using vb script on a aspx page.   Still no go.  
0
PaulHewsCommented:
What happened when you tried this:

objmail.BodyFormat = MailFormat.Html

message = "Your email message has been received and you will receive a response shortly<br />Thank You for contacting TheApartmentGallery.com"
0
mgmhicksAuthor Commented:
This is what I got after doing that.

Your email message has been received and you will receive a response shortlyThank You for contacting TheApartmentGallery.com
0
cmcawoodCommented:
I tested it out with both my suggestion and PaulHews one, here is the code I used and it worked 100% with both.
<%@ Import Namespace="System" %> 
<%@ Import Namespace="System.Web.Mail" %> 
 
<head>
<script type="VB" runat="server" > 
 
Private Function SendConfirmation()
 
	SmtpMail.SmtpServer = "your.mailserver.here"
 
	Dim message As String
	dim objMail as new MailMessage()
	message = "Your email message has been received and you will receive a response shortly" & VbCrLf & "Thank You for contacting TheApartmentGallery.com"
	objmail.to = "my@email.goes.here"
	objmail.from = "your@email.goes.here"
	objmail.subject = "Auto Response From the Apartment Gallery"
	objmail.body = message
 
	SmtpMail.Send(objmail)
 
End Function
 
Sub Page_Load(sender As Object, e As EventArgs)
	SendConfirmation()
End Sub
 
</script>
</head>

Open in new window

0
mgmhicksAuthor Commented:
Thank you the vbcrlf statement is the one that works with the vb script.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.