vbCrLf

D

dancer

Then why do I not get new lines with this code?

'Set the body
objMM.Body = DateTime.Now + " feedback was sent from an ASP.NET " &
_
"Wheeler's Accident Investigation Form" & _
vbCrLf &vbCrLf & _
Check1.Text & "." & vbCrLf & vbCrLf & _
vbCrLf &vbCrLf & _
Check2.Text & vbCrLf
 
J

Juan T. Llibre

Probably because you're writing HTML.

vbCrLf only works within VB.NET code.

If you're writing HTML, use <br> :

'Set the body
objMM.Body = DateTime.Now + " feedback was sent from an ASP.NET " & _
"Wheeler's Accident Investigation Form" & "<br>" & Check1.Text & "." & "<br>" & Check2.Text & "<br>"
 
D

dancer

I am confused.

You will notice that this is VB, not HTML. What do I use so that
Location.Text and Check1.Text and Check2.Text will be on a new line when
they appear in the e-mail?

<script language="VB" runat="server">


Sub btnSendFeedback_Click(sender as Object, e as EventArgs)

'Create an instance of the MailMessage class
Dim objMM as New MailMessage()

'Set the properties - send the email to the person who filled out
the
'feedback form.
objMM.To = (e-mail address removed)

objMM.From = "(e-mail address removed)"
'send in html format
objMM.BodyFormat = MailFormat.Html
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal

'Set the subject
objMM.Subject = "Accident Investigation Form"

'Set the body
objMM.Body = DateTime.Now + " " & _
Location.Text & _
vbCrLf & vbCrLf & _
Check1.Text & "." & vbCrLf & vbCrLf & _
vbCrLf &vbCrLf & _
Check2.Text & vbCrLf

'Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub
 
G

Guest

But you don't use <br> in VB do you? Only in HTML?

when you have

objMM.BodyFormat = MailFormat.Html

you have to use HTML - so, you have to use a <br> tag

when you will change

objMM.BodyFormat = MailFormat.Text

you can use vbCrLf to make new lines.

In this case your email message will be sent as a plain text.
 
J

Juan T. Llibre

re:
!> You will notice that this is VB, not HTML.

Actually, it *is* HTML.

Maybe you missed this line :

'send in html format

What you are doing in that code is *composing HTML*.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top