Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add Multiple textbox values to email?
#1
I haven't coded in ages and am only just getting back into it.
I thought I would just much around with a few functions that everyone seems to use in their programs as a bit of a slow start back into it. I seem to be doing pretty well so far, especially seeing as vb.net is a bit different for me (learnt on vb6).
Anyway, I was messing with the e-mail function... and I could only add one textbox value to the body. Here is the code I'm trying to use:
Code:
Dim Mail As New MailMessage
        Mail.Subject = txtUser.Text
        Mail.To.Add(txtGMAILUser.Text)
        Mail.From = New MailAddress(txtGMAILUser.Text)
        Mail.Body = txtName.Text
        Dim SMTP As New SmtpClient("smtp.gmail.com")
        SMTP.EnableSsl = True
        SMTP.Credentials = New System.Net.NetworkCredential(txtGMAILUser.Text, txtGMAILPass.Text)
        SMTP.Port = 587
        SMTP.Send(Mail)

I want to add more text boxes on Mail.body, but can't figure out how to do it. I just keep creating syntax errors.
Does anyone know how to do this?
Reply
#2
No one at all?
Reply
#3
Use & to concatenate strings.

Eg.

Code:
Mail.Body = txtName.Text & Environment.Newline & txtBody.Text
Reply
#4
Ahh, thanks. I'll give it a try.
Beautiful. Thanks mate.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What could i add to my browser? [Project] XDarkCoder 3 1,214 02-16-2013, 10:10 AM
Last Post: Swift Swim
  how to display google captcha picture on form and add to textbox hit ok to bypass polas 0 1,181 09-14-2012, 01:59 PM
Last Post: polas
  [C#] Switch Array Values - LINQ AceInfinity 0 880 04-06-2012, 11:45 PM
Last Post: AceInfinity
  How can i add a thread? Modestep 2 1,006 11-16-2011, 06:24 AM
Last Post: TalishHF
  [Release] TextBox Color Changer [Release] Resistance 23 6,073 10-14-2011, 02:55 PM
Last Post: Resistance

Forum Jump:


Users browsing this thread: 1 Guest(s)