The best way to send bulk emails for a faster way is to use threads.I wrote this console application to send bulk emails. I split the primary email id into two batches by creating two thread pools.
using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Net.Mail; namespace ConsoleApplication1 { public class SendMail { string[] NameArray = new string[10] { "Recipient 1", "Recipient 2", "Recipient 3", "Recipient 4", "Recipient 5", "Recipient 6", "Recipient 7", "Recipient 8", "Recipient 9", "Recipient 10" }; public SendMail(int i, ManualResetEvent doneEvent) { Console.WriteLine("Started sending mail process for {0} - ", NameArray[i].ToString() + " at " + System.DateTime.Now.ToString()); Console.WriteLine(""); SmtpClient mailClient = new SmtpClient(); mailClient.Host = Your host name; mailClient.UseDefaultCredentials = true; mailClient.Port = Your mail server port number;
I defined 10 recipients in the array list for the sample. It will create two batches of letters to create two thread pools for sending letters. You can also get data from your database.
You can use this code by copying and pasting it into a console application. (Replacing the program.cs file). Then the application will be ready to use.
Hope this helps you :).
Vijaya Priya Nov 06 '09 at 12:08 2009-11-06 12:08
source share