Hi, I need help with sending an email through gmail from a program. I substituted email adresses and passwords with generic names, this program works up to the last line where it fails to send the email. Any ideas as to why this may be?

This is using

imports system.net.mail

btw

Dim mail As New MailMessage()
        mail.From = New MailAddress("email1@gmail.com")
        mail.To.Add("email2@gmail.com")
        mail.Subject = "This is an email"
        mail.Body = "this is the body content of the email."
        Dim smtp As New SmtpClient("smtp.gmail.com")
        smtp.Credentials = New Net.NetworkCredential("email1@gmail.com", "password")
        smtp.Send(mail)

never mind I figured it out, in case anyone was wondering I had to change the port number and enable SSL

never mind I figured it out, in case anyone was wondering I had to change the port number and enable SSL

can you explained to me, how to figured it out???
cause i have this problem too.
Thank's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.