View Full Version : adding items to mail message body
wisemx
12-16-2007, 01:48 AM
In the part that contains the text for the body now you can build more text into it.
Dim BodyString As String = ""
BodyString &= "Some text "
BodyString &= "Some more text "
MailMsg.Body = BodyString + "Coaches Name" + TxtCoachName2.Text
You can break lines, carriage returns,withcode line strings.
Post Edited (wisemx) : 12/16/2007 1:52:48 PM GMT
collegefootballsim.com
12-16-2007, 03:58 AM
hey guys, how do i add multiple items to body of my message? here's my code:
[quote]
(
Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArg s) Handles Wizard1.FinishButtonClick
Dim strFrom = TxtEmail2.Text
Dim strTo = "staff@collegefootballsim.com"
Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
MailMsg.BodyEncoding = Encoding.Default
MailMsg.Subject = "Feedback"
MailMsg.Body = "Coaches Name" + TxtCoachName2.Text
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "localhost"
SmtpMail.Send(MailMsg)
End Sub)</CODE>
now, if I want to add more items to mailmsg.body what do I need to put in to separate the different items? Or how do I arrange them? I know it's probably something simple, just don't know what it is.
Thanks!
collegefootballsim.com
12-16-2007, 05:45 AM
Works perfectly! Thank You
Now, how do I add line breaks in the body?
wisemx
12-16-2007, 06:20 AM
A quick and simple method would be with vbCrLf: (Control Line Feed...Old school VB method.)
[quote]
MailMsg.Body = "Message" & vbCrLf & vbCrLf & "More message on new line..."</CODE>
vBulletin® ©Jelsoft Enterprises Ltd.