Sending email from WE - socket scope

  1. 7 weeks ago

    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

  2. Louis D

    Jul 30 Pre-Release Testers, Xojo Pro QC, Canada

    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.

  3. Edited 7 weeks ago

    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

  4. Ralph A

    Jul 30 Santa Monica, California
    Edited 7 weeks ago

    @Roman V When sending emails from a web app, the socket should be at the session or at the app level[Roman

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

  5. Louis D

    Jul 31 Pre-Release Testers, Xojo Pro QC, Canada

    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.

  6. Bob K

    Jul 31 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    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.

  7. Greg O

    Jul 31 Xojo Inc

    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.

  8. Louis D

    Jul 31 Pre-Release Testers, Xojo Pro QC, Canada

    ... 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...

  9. Edited 7 weeks ago

    Hey everybody, thanks for your input....

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

    R

or Sign Up to reply!