Link to home
Start Free TrialLog in
Avatar of moosetracker
moosetracker

asked on

Sending Email in Visual studio Can only send out 11 at a time!

After 11 emails I get the following error.

Insufficient system storage. The server response was: 4.1.0 Too many emails sent on this session

I read enough to know that this is a common error with the logic I am using, but most people comment the threshold is 100 emails.. 100 would be fine, as I have to send out about 83 - 90..
But my email list could grow.

So is there a different method I should be using? If not is there something I can do to get my threshold up to at least 100?

Below is the code I am using.
for (int idx = 0; idx < lstUnitInfo.Count; idx++)
        {
           mMailMessage = new MailMessage();
           // Set the sender address of the mail message
           mMailMessage.From = new MailAddress("wendavcs@comcast.net");
           string setSubject = "";
           try
            {
                sglUnitInfo = lstUnitInfo[idx];
                // Set the recepient address of the mail message
                setSubject = "Training Information for " + sglUnitInfo.UnitType +
                    " " + sglUnitInfo.UnitNo;
             
               
               mMailMessage.Subject = setSubject;

                //The To: recipient.. attach 
                if (NormalTest == "Test")
                    mMailMessage.To.Add(new MailAddress(testEmail));
                else
                {
                    for (int i = 0; i < 2; i++)
                    {
                        if (sglUnitInfo.Email[i] != null && sglUnitInfo.Email[i].IndexOf("@") != -1)
                            mMailMessage.To.Add(new MailAddress(sglUnitInfo.Email[i]));
                    }
                }


                SetAttachments();
                PrintBody();

                mMailMessage.Body = fullBody;


                // this is if through IIS
                //SmtpClient mSmtpClient = new SmtpClient("localhost");

                // Instantiate a new instance of SmtpClient
                SmtpClient mSmtpClient = new SmtpClient("smtp.comcast.net");


                // Send the mail message
                mSmtpClient.Send(mMailMessage);

                mMailMessage.To.Clear();
                mMailMessage.Attachments.Clear();
                mSmtpClient = null;
                UpdateTableDate(sglUnitInfo.UnitType, sglUnitInfo.UnitNo);

            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                if (attachmentmsg1 != null)
                {
                    attachmentmsg1.Dispose();
                    attachmentmsg2.Dispose();
                    attachmentmsg3.Dispose();
                    attachmentmsg4.Dispose();
                    attachmentmsg5.Dispose();
                    attachmentmsg6.Dispose();
                    if (mMailMessage != null)
                        mMailMessage.Dispose();
                    
                }
            }
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of moosetracker
moosetracker

ASKER

Not what I was hoping to hear, but thanks. Seems I can have alot of contacts in one email, Just not many seprate emails.

I might try grouping Training annoucements together more for ones that are just general information.

Unfortunately If I am sending confidentail information I have to leave it at sending out individual unit per unit.

I set up to update a date field when the email is sent, then when it blows the next run will bypass the units that the date has been set to current date. But I have to run through about 7 abnoxious errors to get the emails completely out.

Seems like if coming out of the program and then going back in resets and lets me send out 11 more, there should be something that we could reset programmically.
No, you need to limit how many contacts in an email also.  When your email hits the server, it gets repeated as many times as there are contacts and that's what counts to your ISP.

You should be aware that ISPs like Comcast and AT&T and the email services like Gmail, Yahoo, and Hotmail are more concerned about limiting spam than delivering your email.  If you exceed their limits, they usually just cut you off.  That's why we keep recommending the services like Constant Contact.  Bulk email is their business.  Some of them are free also.
Thanks I will look into that, Free is good as this is voluntery work, with no capital from a Buisness.

 Weird with my units some I have 1 contact others 2 or 3.. Doesn't matter if within the entire group I have sent out 11 emails or 33 in all.. It always cuts off at 11 seperate emails. Also my in-laws use the same service they are into passing everyone in the world jokes and stories. The list of email contacts they seem to throw into one email is outragous!
I know what you mean but I don't know how to explain that.  I just know that we get a lot of questions here about bulk email with the same problems over and over.  I can't recommend that you try it and see if you get lucky.  All I can do is tell you about the known problems and solutions.