Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Send thousands thousands of emails with SMTP ?

Send thousands thousands of emails with SMTP ?

Scheduled Pinned Locked Moved ASP.NET
sysadmindata-structuresperformancequestion
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D devboycpp

    Hi I need to send a large number of emails as newsletter in website using SMTP protocol. The barrier is the server runs out of memory and raises an exception when emails count is large. I use a loop that iterates through an array of emails and send them. Is there any method that can mitigate this constriction. emails count is more than 100000.

    F Offline
    F Offline
    fjdiewornncalwe
    wrote on last edited by
    #2

    If you are working for a website with 100,000+ subscriptions to a newsletter, you probably work for a website that should have it's own smtp system setup to deal with this. If it doesn't, I'm a little concerned that this "newsletter" you speak of is really more of a "spamletter"...

    I wasn't, now I am, then I won't be anymore.

    1 Reply Last reply
    0
    • D devboycpp

      Hi I need to send a large number of emails as newsletter in website using SMTP protocol. The barrier is the server runs out of memory and raises an exception when emails count is large. I use a loop that iterates through an array of emails and send them. Is there any method that can mitigate this constriction. emails count is more than 100000.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #3

      If the server is running out of memory than there isn't much you can do. Even if you dispose of the objects the GC is non-deterministic so it may not free any memory in time to prevent the problems. You could try multi-threading but it would still face the same memory constraint. Another options if available is to use two, or more, SMTP servers. Sending this many emails at once would be better handled by a bulk email service. Also sending out that many emails at once you are risking your domain being blacklisted as a spammer.


      I know the language. I've read a book. - _Madmatt

      D 1 Reply Last reply
      0
      • N Not Active

        If the server is running out of memory than there isn't much you can do. Even if you dispose of the objects the GC is non-deterministic so it may not free any memory in time to prevent the problems. You could try multi-threading but it would still face the same memory constraint. Another options if available is to use two, or more, SMTP servers. Sending this many emails at once would be better handled by a bulk email service. Also sending out that many emails at once you are risking your domain being blacklisted as a spammer.


        I know the language. I've read a book. - _Madmatt

        D Offline
        D Offline
        devboycpp
        wrote on last edited by
        #4

        Is there a way to make sending emails slower ? For example make it take 1 hour or more to send emails to alleviate the burden. Asynchronous or some sort of that technique .

        N 1 Reply Last reply
        0
        • D devboycpp

          Is there a way to make sending emails slower ? For example make it take 1 hour or more to send emails to alleviate the burden. Asynchronous or some sort of that technique .

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #5

          You can always create a service the will send so many emails per hour. You are in complete control of the code.


          I know the language. I've read a book. - _Madmatt

          D 1 Reply Last reply
          0
          • N Not Active

            You can always create a service the will send so many emails per hour. You are in complete control of the code.


            I know the language. I've read a book. - _Madmatt

            D Offline
            D Offline
            devboycpp
            wrote on last edited by
            #6

            I know , I wanna ask "is it helpful to invoke Sleep(milliSeconds) function in the body of the loop to mitigate this problem ? " Or another technique should be used ? for example creating threads or invoking functions asynchronously ?

            P 1 Reply Last reply
            0
            • D devboycpp

              I know , I wanna ask "is it helpful to invoke Sleep(milliSeconds) function in the body of the loop to mitigate this problem ? " Or another technique should be used ? for example creating threads or invoking functions asynchronously ?

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #7

              Never, ever use Sleep to block processing for a period in time. It's a poor design choice.

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              D 1 Reply Last reply
              0
              • P Pete OHanlon

                Never, ever use Sleep to block processing for a period in time. It's a poor design choice.

                I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                D Offline
                D Offline
                devboycpp
                wrote on last edited by
                #8

                Can you give me a pragmatic way to send emails slowly to compensate for lack of server resources ?

                P 1 Reply Last reply
                0
                • D devboycpp

                  Can you give me a pragmatic way to send emails slowly to compensate for lack of server resources ?

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #9

                  If you need to send that many emails, you need to run the application on a separate server (actually it should be from several servers). Never attempt to use the web server to do this because you will always be competing with HTTP traffic (plus, it's a good idea to have the SMTP protocol on a different server to the one running the HTTP protocol. Try to keep your resources separated out for security purposes).

                  I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                  Forgive your enemies - it messes with their heads

                  My blog | My articles | MoXAML PowerToys | Onyx

                  D 2 Replies Last reply
                  0
                  • P Pete OHanlon

                    If you need to send that many emails, you need to run the application on a separate server (actually it should be from several servers). Never attempt to use the web server to do this because you will always be competing with HTTP traffic (plus, it's a good idea to have the SMTP protocol on a different server to the one running the HTTP protocol. Try to keep your resources separated out for security purposes).

                    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Onyx

                    D Offline
                    D Offline
                    devboycpp
                    wrote on last edited by
                    #10

                    For some reasons we need to countenance our current server configuration with limited resources. So we don't expect ideal. The delay is not a problem even if it takes 3 hours to send them. We can run the send operation when the site traffic is on the wane.(e.g. 3 AM) What do you think then ? Thanks Regards

                    1 Reply Last reply
                    0
                    • P Pete OHanlon

                      If you need to send that many emails, you need to run the application on a separate server (actually it should be from several servers). Never attempt to use the web server to do this because you will always be competing with HTTP traffic (plus, it's a good idea to have the SMTP protocol on a different server to the one running the HTTP protocol. Try to keep your resources separated out for security purposes).

                      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Onyx

                      D Offline
                      D Offline
                      devboycpp
                      wrote on last edited by
                      #11

                      I just asked for a solution matching my current configuration ?

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups