SMTP through ASP.Net 2 Session Size Problem

I have checked the SMTP Mail servers mail message size limit using same SMTP server and user name, password in the outlook express.

SMTP through ASP.Net 2 Session Size Problem

Why is the session growing? Are you doing this within a request's lifetime?

I'm assuming you're "tracking" by keeping info about emails sent within the session state. I'd write a tracker that can batch-write tracking information to exterior storage, such as xml files on disk or a sql database.

If the tracking part isn't whats causing issues, but the one-at-a-time email (or the widget sending them) is, you can try batching emails and BCC them rather than sending them out one at a time. Blind Carbon Copies are always personally addressed and don't reveal to the recipient that it was mass mailed. You just have to figure out the limit on the number of emails you can send via BCC.

Third option is to, in your web app, drop what you need to generate these emails into a common storage location and have a windows Service app (or a scheduled task app) that regularly checks for new email jobs and processes them outside of your web app... maybe even outside of your web app's host server. Of course, this kind of thing wouldn't work on shared hosting servers...

I never used ASP.NET to wrie one line of code so I can't help you with coding area, but what I can do is to help you pointing out the error. I have advance level of understanding for SMTP protocol and have experience of running SMTP server which on average around one million individual email per days.

The error you mention "Maximum Session Size" is actual reason for confusion. Even this error clearly said 'size' actual problem is 'number', a very big number for your email server to accept. Every email (SMTP) server configured in way that it limits various number of factor like individual email number, final recipient number etc for security reason. Let's say someone try to send 1MB size of email to thousand recipient which for user only need to transfer around 1MB of data from their host end to SMTP server where server itself must have to transfer 1GB of data to deliver to all of these email successfully. More than 2GB of data in case of bouncing every email back. For protecting this type of attack to mail relay server, SMTP daemon set some kind of limit. On your case your script is connecting to SMTP server for one time and start relaying thousands of individual email without ever disconnecting ever. Server actually doesn't care either you sending it from ASP.NET program or any other email client it will limit and reject you when number crossed the limit.

As you talked about 'loop' for generating every individual email, just set another loop to disconnect and connect to SMTP for every 500 email relay done. Remember, your SMTP server rejecting you not because of you cross some size limit but you reached maximum allowed email relay from any single connecting. Connect, Relay fixed number of email, disconnect, then connect again to send next batch of mail and loop it untill you finish relaying every single mail you need to deliver.

We do much the same thing, but we do 500 emails at a time per minute. The first 500 get sent, then the page reloads itself, and the job continues on with the next 500.

This take a little bit of logging and storing information about the current queue of 500, allowing for timeouts, early reloads, etc, but it has been working (emailing probably 10,000 or so emails on any given night) for a couple of years.


Click Here to Visit

What's Your Reaction?

like
0
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0