I have 2000 emails to send to my customers.
But I what that, it sends 400 emails at a time. How can I do that? Please help me! Thanks

You'll need to keep track of how many it sends and tell it to stop and wait a specified amount of time when that number reaches 400.

Here's an example. I do not know how long you might want it to wait, I assumed 30 seconds.

int SentEmails = 0;

            if (SentEmails != 400)  //This code will run if you have not yet sent 400 emails
            {
                //Your code to send an email
                SentEmails++; //Add one to SentEmails
            }

            else //SentEmails equals 400.
            {
                SentEmails = 0;                         //Set it back to zero so we can do it all over again
                System.Threading.Thread.Sleep(30000);    //Wait thirty seconds. (The amount is in milliseconds)
            }

Hi WildBamaBoy! Can you tell me how to send those mail fast based on my require ?

I'm not really understanding what you mean but I'm guessing it's waiting too long. To make it go faster you'll need to change line 12 to a lower value. The value is in milliseconds and you can get that simply multiplying the number of seconds you want by 1000. If you want 2 seconds type 2000, 5 seconds 5000, 0.5 seconds 500, etc.

thanks WildBamaBoy. Can u tell me how many emails sent by gmail at a time and a day are permitted ?

This article has been dead for over six months. Start a new discussion instead.