Dismiss Notice
A Message from Viotek
At Viotek, we’re gamers at heart. That’s why we’re extremely excited to be teaming up with Se7enSins, a gaming community created by gamers, for gamers. Their focus? Bringing high-quality content and discussion to the industry. That’s exactly how we feel about our monitors and gaming peripherals. From making high-performing curving monitors more affordable, to breaking all rules with color-rich TN panels. In the coming weeks, we’ll be working with Se7enSins to deliver branded content, promotions and contests to their diverse, tight-knit community. For us, it’s more than a game. It’s life. Save $20 on your next purchase using the link below. Valid through May 31st. https://amzn.to/2Hxxxyx

Need Help Sending Mail

Discussion in 'Programming & Scripting' started by Genetic Paradox, Jul 25, 2009 with 3 replies and 372 views.

  1. Genetic Paradox

    Genetic Paradox Enthusiast

    Messages:
    422
    Ratings:
    60
    This code should work just fine but when I'm debugging it but it gives me this error every time I try to send the message"A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll". There is no elaboration on the error. That is all I get.
    Code:
    Dim MyMailMessage As New MailMessage()
    Try
    MyMailMessage.From = New MailAddress("[email protected]")
    MyMailMessage.To.Add("[email protected]")
    MyMailMessage.Subject = "Rabid Rabi"
    MyMailMessage.Body = TextBox3.Text + TextBox4.Text
    Dim SMTP As New SmtpClient("smtp.gmail.com")
    SMTP.Port = 486
    SMTP.EnableSsl = True
    SMTP.Credentials = New System.Net.NetworkCredential("[email protected]", "DICKSEVERYWHERE")
    SMTP.Send(MyMailMessage)

     
  2. Ibdc

    Ibdc VIP VIP Retired

    Messages:
    5,100
    Ratings:
    2,072
    Don't use a try catch for the whole thing, only the actual sending.
     
    • Like Like x 1
  3. James Iz A Pro

    James Iz A Pro Enthusiast

    Messages:
    62
    Ratings:
    2
    Try This Code
    Code:
    Declarations:
    Imports System.Net.Mail
    
    The Send Button Code:
    
    Dim WC As New System.Net.WebClient
    Dim MyMailMessage As New MailMessage
    MyMailMessage.From = New MailAddress("[email protected]")
    MyMailMessage.To.Add("[email protected]")
    MyMailMessage.Subject = "Rabid Rabi"
    WC.Dispose()
    MyMailMessage.Body = TextBox3.Text + TextBox4.Text
    Dim SMTPServer As New SmtpClient("smtp.gmail.com")
    SMTPServer.Port = 587
    SMTPServer.Credentials = New System.Net.NetworkCredential("[email protected]", "Password")
    SMTPServer.EnableSsl = True
    Try
    SMTPServer.Send(MyMailMessage)
    Catch ex As SmtpException
    End Try
    End If
    
     
    • Like Like x 1
  4. OP
    Genetic Paradox

    Genetic Paradox Enthusiast

    Messages:
    422
    Ratings:
    60
    I got it working. Thank you both very much.
     

Share This Page