Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to send emails in VB.NET using Multithreading?

dawnieldawniel PortugalMember Posts: 1

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
    Try
        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.To.Add(totxt.Text)
        danielmail.Subject = "Email Sending"
        danielmail.IsBodyHtml = False
        danielmail.Body = msgtxt.Text
        Smtp_Server.Send(danielmail)
        MsgBox("Dear Daniel, your email has been sent.")

    Catch error_t As Exception
        MsgBox(error_t.ToString)
    End Try
End Sub

Here's my picture showing what I'm looking for:
http://i.imgur.com/04ZJwml.png

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.

Tagged:
Sign In or Register to comment.