A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll RRS feed

  • Question

  • Can someone help me with this?

    A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll

    when i press i receive that message in 2 seconds.

    here's my code!

            Dim MyMailMessage As New MailMessage()
                MyMailMessage.From = New MailAddress("fromemail@gmail.com")
                MyMailMessage.Subject = TextBox1.Text
                MyMailMessage.Body = TextBox2.Text
                Dim SMTP As New SmtpClient("smtp.gmail.com")
                SMTP.Port = 587
                SMTP.EnableSsl = True
                SMTP.Credentials = New System.Net.NetworkCredential("eusername", "jpassword")
                MsgBox("Message Has Been sent!!")
            Catch ex As Exception

            End Try

    the msgbox doesnt show too!

    I hope that someone will help me with this.

    Sunday, May 2, 2010 8:59 AM


All replies

  • See Smtp Exception?
    Only performance counts!
    Sunday, May 2, 2010 2:20 PM
  • Use breakpoints to find when exactly the exception is thrown. Most likely your username, passsword, or server info is incorrect.
    Sunday, May 2, 2010 2:39 PM
  • This one have very very simple solution. Your client has no problem. It is gmail who is the culprit here. You just need to change your gmail settings.

    Here is the change bellow:

    1. Click the gear icon in the upper right, then select Settings.
    2. In the General tab, set "Browser connection" to one of the following:
      • Always use https
      • Don't always use https
      Note: If you've never changed the setting, no radio button will be selected, but the default is "Always use https."
    3. Click Save Changes.
    4. To start accessing Gmail via HTTP, manually change the URL to http://mail.google.com.

    Tuesday, January 15, 2013 12:45 AM