Link to home
Start Free TrialLog in
Avatar of mbacs
mbacsFlag for United States of America

asked on

send email from vb.net useing gmail

Im trying to send a email using my gmail any idea why this is not working?
this is the code

    Sub SendEmail()

        Dim insMail As New MailMessage()

        insMail.Sender = New MailAddress("myemail@gmail.com")
        insMail.From = New MailAddress("myemail@gmail.com")
        insMail.To.Add(New MailAddress("myemail@yahoo.com"))
        insMail.Subject = "Testing message"
        insMail.Body = "i hope it delivered"

        Dim Smtp As New SmtpClient

        Smtp.Host = "Smtp.gmail.com"
        Smtp.Port = 587
        Smtp.EnableSsl = True
        Smtp.Credentials = New Net.NetworkCredential("myemail@gmail.com", "mypassword", "smtp.gmail.com")

        Smtp.Send(insMail)

    End Sub

and this is the error

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required d24sm7131381and


any help?
Thanks
SOLUTION
Avatar of surajguptha
surajguptha
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial