Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7581431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:12:05+00:00 2026-05-30T18:12:05+00:00

I have created a simple form which is loading a csv file with few

  • 0

I have created a simple form which is loading a csv file with few columns like email, name, city and I’m trying to send them daily updates via 2 smtp servers I have. I thought to use a backgroundworker because it’s progress capabilities(for the progressbar I have) but I read also on this website that there are other alternatives like task, thread or threadpool.

I also read that sending emails must be done with an async method. I don’t know if it’s possible or if it’s optimized for performance, but I’m trying to do the following:

for each smtp I wanna use a thread to read, let’s say, 10 lines from the csv file,
split the line by fields and send the info to another thread which will send the message to each email in that small list. I wanna do this to save some precious time for each smtp auth procedure.

Because connecting to the smtp for each email requires the whole socket procedure everytime, like HELO, AUTH, DATA. If I’m gonna send a list of email, I can keep the socket open after auth and change only the data I send. 10 lines is just a variable which can be custom changed.
So, 2 tasks for each smtp, means 4 in total or can be increased based on the number of smtps I will use.

Can I also use additional threads for each task or backgroundworker?

I’m kinda confused because I’m new to c# and I haven’t found any example about this. It’s been more than a week since I’m trying to understand how backgroundworker/threads work but still unsuccessfully. Any help would be appreciated and any idea better than mine to improve the performance Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:12:06+00:00Added an answer on May 30, 2026 at 6:12 pm

    First off you need to understand the difference between the different types of threads.

    A threadpool is just a collection of threads available for use. The threads used by the pool are managed by the pool & returned there after use. The idea is you get performance benefits because the cost of creating the thread only happens once.

    A background worker is a thread that runs in the background. The only difference between a background and foreground thread, is a background thread will not prevent a process from terminating.

    Sending emails async is more SHOULD rather than MUST. The smtp component has no concept of seperating the connect form the send.

    I think what you want to do is:

    • initalise a number of threads, say 10.
    • Read a line from the csv.
    • Pass this line to a thread from above. If no threads are available, wait till one is.
    • In the thread parse the line and send the mail. Sending doesn’t need to be async with this method but you can if you want. When you’re done sending, return the thread to the pool ready for the next line

    You can manage your threads as a pool – there are many examples around if you google for thread pools – or you can do it by hand using manualresetevents to handle the wait. The advantage of doing it with a pool is you can change the number of workers available easily without affecting your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple web form on ASP.NET which includes a DropDownList with
I am a bit confused. I have created a simple form with a one
I have created a simple test form with FormBorderStyle = FixedToolWindow by default and
How to manually create Friendly URLs? (PHP) So I have created simple php file
I have created a simple wcf service which used the WCF Service Library template.
I have created a simple Asp.Net custom control which automatically combines all the correct
i have created a simple public ref class in the vc++ project, which is
I've created a simple user control which is manually created with something like MyUserControl
I have a simple ASP.Net MVC View which contains an FCKeditor text box (created
I have created a PHP form, which, upon submission, goes to another PHP page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.