Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to send emails in VB.NET using multithreading?

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 1.00k
    Answer it

    As I'm not familiarized with VB.NET I am requesting help for my last school project this year.

    So I have a ListView with many emails and want to send a certain message to those emails but using multithreading because If don't the application will stop responding. I also want to send that message X times to the same email and then pass to another one with multithreading too.

    Keep in mind, this NOT a spammer as everyone is saying to me on another forums. I'm doing this for my last school project this year and I chose to make an bulk email sender.

    So that's the code I have:

     Private Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
            Dim Smtp_Server As New SmtpClient
            Dim danielmail As New MailMessage()
            Smtp_Server.UseDefaultCredentials = False
            Smtp_Server.Credentials = New Net.NetworkCredential(usertxt.Text, passtxt.Text)
            Smtp_Server.Port = portxt.Text
            Smtp_Server.EnableSsl = True
            Smtp_Server.Host = smtptxt.Text
            danielmail = New MailMessage()
            danielmail.From = New MailAddress(fromtxt.Text)
            danielmail.Subject = "Email Sending"
            danielmail.IsBodyHtml = False
            danielmail.Body = msgtxt.Text
            MsgBox("Dear Daniel, your email has been sent.")
        Catch error_t As Exception
        End Try
    End Sub

    Here's my picture showing what I'm looking for:

    I'm not really familiarized with VB.NET, that's why I'm asking someone to help me deeply. I'm not here to get my whole project done, just want a good help, I'm like 0 skill with VB.NET but need this done, I'm willing to get any help from you.

 1 Answer(s)

  • Hi , You may use the SmtpClient.SendAsync method for sending emails. Since the method does not block the calling thread the application will remain responsive. For more details you may check the official link (

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: