Send asp.net newsletter about 10,000 emails

I need to write a request to send a newsletter. What is the best way to send newsletters to thoundands users? My requirement

  • Each mail separately: To:
  • Each mail has a unique Unsubscribe link

Is it good to use the .net mail class SMTP? I look, maybe there are so many questions, but I can’t decide which one I need to go to? There are many suggestions

  • Windows multithreaded service
  • Use mail server
  • Add thread.sleep (2000) between each submission.

Can anyone suggest a good way to do this?

+7
email smtp
source share
5 answers

I would not recommend the asp.net webpage to submit, even if you run it in a separate background thread. I think you risk that the server will process your process in the middle of sending, which will ruin it. You really need to write some kind of separate service or application to send your letters.

The easiest option is to simply create a quick and dirty application for the console or windows.

Registration is also important, as is another poster. If this fails, you want to know exactly what was sent and where it was stopped, so that when you restart, you do not mail all the people for whom it worked again. You want to be able to enter a starting point for sending, so if you need to reset your email number 5000, you can.

Classes in the System.Net.Mail namespace will work just fine for sending your mail.

One of the biggest problems will be finding an email site that will allow you to send so many emails. Most email hosts are throttled and sometimes change depending on server conditions, so if the server is heavily used, email restrictions will be more restrictive and you can only set 500 emails per hour.

We have a newsletter that reports about 20,000 people as separate emails, and we had to play with a delay between emails until we found one that will work on our email host. We got 1.2 seconds between emails, so this could be a good starting point.

I think there are email sites that specialize in bulk mailing, although if you get one of them, that might not be a problem.

In addition, if you post your own email address, this may not be a problem. And if you post your own mail, you will have the opportunity to refuse mail in the pickup directory, and you can simply dump it all there as quickly as you want, and let the email service pick it up at your own pace.

EDIT: Here are the settings you need to add to the configuration file to configure the pickup directory

<system.net> <mailSettings> <smtp from="support@test.com" deliveryMethod="SpecifiedPickupDirectory" > <specifiedPickupDirectory pickupDirectoryLocation="Z:\Path\To\Pickup"/> </smtp> </mailSettings> </system.net> 
+8
source share

Definitely do not do this in ASP.NET. This is one of the biggest mistakes new web developers make.

This must be a Windows application or service that can handle this amount.

+2
source share

I wrote pages that send emails, but not the amount that you will have. However, I would recommend the following based on the code that I implemented in the past:

  • Use the web application to write out the email address and all recipient addresses in the database table (s).

  • Have a process that is outside of ASP.NET does send emails. This can be a vbs file that is configured as a scheduled task or (preferably) a Windows service. This process will take the text of the email message, add a link to unsubscribe, and after the successful sending of the flag the database will be sent. Thus, if the sending failed, it may try again later (the sending process iterates over all the records marked as unsent).

  • If you need a log of what was sent, and when you just need to save the sent records in the database tables. Otherwise, simply delete the records that were sent successfully.

IMHO sending emails in an ASP.NET workflow is a bad idea because you don’t know how long it will take, and if you don’t have the opportunity to retry before the page expires.

+1
source share

Create a web page to “design” the newsletter. When they click "Submit", upload the newsletter somewhere (database) and use another program (Windows service, etc.) to send the queue. It will be many times more efficient and potentially fault tolerant if properly designed.

+1
source share

I wrote the Newsletter module (as part of a larger system) in ASPNET MVC 2, Entity Framework and using the System.Net.Mail namespace. It runs in sight and actually just runs in the controller with a supporting method for sending. When each email is sent, I keep track of whether there is a complex bouce (exception thrown) and I update this database record with an error with an exception, otherwise I update the record confirming success. We also do personalization, so we have “tags” that are replaced by an additional field in the database (stored as XML for flexibility). This helps to handle the unsubscribe function.

My code is pretty simple (please don't cry for using exception handling as business logic;) and it works like a charm.

All this is done on the VPS at http://maximumasp.com , which also contains 4 sites with pretty decent traffic. We use their SMTP servers. We notified them that we needed this service, and we had no problems with the relationship.

We had 2 GB of RAM on a machine running Windows 2008, and it dealt with 6 emails / sec. We pushed it at 3 GB, as the websites needed it, and now the newsletter is about 20 months / sec. Our newsletters range from 2,000 to 100,000 email addresses.

In short, ASP.NET can be used to handle mailing lists, and if you add some logic to handle post updates, the concern that you will lose your sending method in the middle will be mitigated. Yes, there may be simpler ways to do this. We look at MQMS and threads, and also share it with the Windows service to make it more stable and scalable as we have added more clients and larger lists, but at the moment it works great with reasonable reporting and error handling.

+1
source share

All Articles