Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TextBoxes All in the Same mailMessageBody

Status
Not open for further replies.

csdewan

MIS
Apr 11, 2005
16
GB
Hi,

I have a few TextBoxs in a form i have created. I would like the TextBoxes to all link together in my mailMessageBody. At the moment i have mailMessage.Body = TextBox1.Text but i would like the other TextBoxes to be added to the same MessageBody. I cant remember how to get the TextBox to display all there data together in the same messageBody as its a while since i done this. Any help would be great.

Thanks.
 
Concatenate the textbox values together using a stringbuilder. Then set the messagebody = the stringbuidler.
 
Couple of other tidbits (and of course there are many ways to approach this). Here is an example of Juice05's proposition, with a few character breaks, dividing lines, etc.
Code:
'Parse workshops...
     strName = FName.Text & " " & LName.Text
     strAddress = "Address: " & Address.Text & " " & City.Text & ", " & State.Text & " - " & Left(ddZip.SelectedItem.Text,5)
     strEmail = "Email: " & Email.Text
     strPhone = "Contact Phone: " & CPhone.Text
     strComments = "Comments: " & Comments.Text

     strString = WkTest.Text
     WkTest.Text = strString.Replace(";", "" & vbCrLf & vbCrLf & "****************************************" & vbCrLF & vbCrLF & "")
     strString = WkTest.Text
     WkTest.Text = strString.Replace("//", "" & vbCrLf & "")

      
     Dim E_mail As New MailMessage()
     With E_mail
       .To = "awwProg@auburn.edu"
       .cc = "ruizcor@auburn.edu, Auburn_Incoming@yahoo.com"
       .From = "ruizcor@auburn.edu" 
       .Subject = "Certification Registration"
       .Body = strName & " has registered for the following Workshop(s):" & Chr(10) & Chr(10) & "****************************************" & Chr(10) & Chr(10) & WkTest.Text & "Personal Information:" & Chr(10) & "Name: " & strName & Chr(10) & strAddress & Chr(10) & strEmail & Chr(10) & strPhone & Chr(10) & strComments & Chr(10) & Chr(10) & "This email was sent by Page WorkShopRegD.aspx on: " & Now().ToString
       .Priority = MailPriority.High
     End With
    Try
     SmtpMail.SmtpServer = ""
     SmtpMail.Send(E_Mail)    
    Catch exc as Exception
      Response.Write("Send failure: " + exc.ToString())
    End Try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top