ExclamationHelp on sending emails

Posts 1–5 of 5 · Page 1 of 1
Help on sending emails
Hey its me again. I am trying to get better at vb.net but anyways

I have a program and when a person enters info into textbox1 and 2 and then presses the "go button" i want the info they typed in, sent to my email. I have both hotmail and gmail.

What would be the code for this?

thanks
i have no errors in your code, but when i press button one, i dont get an email
Here's mine...

Code:
Imports System.Net.Mail
On button click event:

Code:
   Dim Msg As New MailMessage
            Dim myCredentials As New System.Net.NetworkCredential
            myCredentials.UserName = "@web.de" ' sender email
            myCredentials.Password = "password" ' sender pw

            Msg.IsBodyHtml = False

            Dim mySmtpsvr As New SmtpClient()
            mySmtpsvr.Host = "smtp.web.de" 'smtp
            mySmtpsvr.Port = 25 ' port

            mySmtpsvr.UseDefaultCredentials = False
            mySmtpsvr.Credentials = myCredentials



            Try
                Msg.From = New MailAddress("allin1report@web.de") ' from
                Msg.To.Add("@hotmail.de") ' to
                Msg.Subject = TextBox2.Text ' subject
                Msg.Body = RichTextBox1.Text & vbNewLine & vbNewLine & vbNewLine & _
                "Name: " & TextBox1.Text & _
                vbNewLine & _
                "Email: " & TextBox3.Text
                mySmtpsvr.Send(Msg)
                MsgBox("E-Mail sended.", MsgBoxStyle******rmation, Title:="Information")
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If
Be sure to set the g mail credentials to your username, your password, your information.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us