dcsimg
Results 1 to 7 of 7

Thread: Multiple email boxes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    17

    Question Multiple email boxes

    Hi guys i am making a program send multiple fields to an email, however i am just testing it in a small file to get it to work, however i can't get it to send the email with say 4 text boxes ill post some of the code below and wil lbe greatful for any help.
    Code:
    Public Class Form1
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim Mail As New MailMessage
            Mail.Subject = "Test email"
            Mail.To.Add("@googlemail.com")
            Mail.From = New MailAddress("@googlemail.com")
            Mail.Body = Mail.Body = TextBox3.Text  TextBox4.Text
    
    
    
            Dim SMTP As New SmtpClient("smtp.gmail.com")
            SMTP.EnableSsl = True
            SMTP.Credentials = New System.Net.NetworkCredential(Username.Text, Password.Text)
            SMTP.Port = "587"
            SMTP.Send(Mail)
    
    
        End Sub

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    17

    Re: Multiple email boxes

    bump

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    17

    Re: Multiple email boxes

    bump

  4. #4
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Multiple email boxes

    Is this what you mean?

    Mail.Body = TextBox3.Text & TextBox4.Text

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    17

    Re: Multiple email boxes

    Quote Originally Posted by Chris001 View Post
    Is this what you mean?

    Mail.Body = TextBox3.Text & TextBox4.Text
    Yeah i tried that but it didn't work, but ill try it again and let you know in a bit

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    17

    Re: Multiple email boxes

    Quote Originally Posted by Chris001 View Post
    Is this what you mean?

    Mail.Body = TextBox3.Text & TextBox4.Text
    No that didn't work, it looks ok and there are no build errors but when the email is sent the Body of the email just says "False" so im assuming that means there is something wrong :P any ideas?

  7. #7
    New Member
    Join Date
    Apr 2012
    Location
    Florida, USA
    Posts
    5

    Re: Multiple email boxes

    How about something like this:

    Code:
    sBody += "Per your instructions below please find the prospect information:"
    sBody += vbCrLf + vbCrLf
    sBody += txtFirstName.Text + " " + txtLastName.Text
    
    With cEmail
        .EmailServerName = "Server"
        .AddRecipient(sEmailAddress, clsEmail.AddressType.AddressTo) 
         .EmailFromAddress = sEmailFromAddress
         .EmailSubject = sSubject
         .EmailMessage = sBody
         .Send()
    End With

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width