Sending email from WE - socket scope

When sending emails from a web app, the socket should be at the session or at the app level ?

If it is at the app level, what if two users want to send an email at the same time ?

Should I create a queue ?

thanks!
Roman

In my application, the socket is created at form or container-level. Created only on a as-needed basis.

I suppose that it depends on the processes that you need to support.

Hey Louis,
I need to send a couple of mails in the background… no big numbers from 1 to 10 per hour, maybe less…

Anyway… the question is still valid… what happens if two users want to sen an email at the same time ?
Will the server allow two concurrent connections (from the same IP) ? Will both fail ?

R

I do this at the Session level. Each Session has its own socket (via a Session Property).

Roman, my point with the process is this: you need to figure out where the socket is required in your application. I only need to send emails in one specific area of mine, so it makes sense that I will define the socket at the form (container) level. I am working on another app where it will be useful to do as Ralph says; session level. Mails can be sent from various processes in that application.

If you are dealing with low volumes, you don’t have to worry too much about connections to the server. At least, I never encountered, nor have i seen here on the forum, any issue specifically related to this. Volume is the key factor that you will have to manage.

I do this at the application level. App starts and I create a global class that checks the database periodically for new mail and then creates the socket and sends the email.

It’s not as efficient as one would hope. I should probably make it a separate console app that just runs in the background that does the exact same thing.

Keep in mind that sockets run on the main thread and are therefore not associated with any particular session. If you need them to be, you’ll need to subclass the socket and add some code to keep track of that.

… so I have been wasting my time trying to isolate sockets within the process where they are used. App level it is going forward. I guess that I should RTFM more often…

Hey everybody, thanks for your input…

I used basically a similar model to what @Bob Keeney said. I have an EmailManager class that handles all mailing stuff and its a property of the app.

R