Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What sort of gotchas/tips/hints can you share for a .Net program which will send possibly 10k+ emails a day to subscribers?

Tags:

c#

.net

email

I know how to write the basic c# code to send emails, but I'm wondering about any larger issues involved. Are there things I should avoid? Best practices? etc

Thanks!!

like image 330
Tad Donaghe Avatar asked May 04 '09 19:05

Tad Donaghe


People also ask

How can I send a lot of emails at once?

The BCC method The BCC (Blind Carbon Copy) method is the most common approach to send emails to multiple recipients at the same time. Emailing to multiple recipients using the BCC feature hides other recipients from the recipient, making it look like he is the sole recipient of the email.


2 Answers

  • Make sure you use a hosting service which will not disable your account because of the amount of email you send.
  • Add some kind of audit or logging so you know what mails you have sent
  • Use BCC to send the same mail to multiple recipients
  • Queue the mail to avoid bursts of emails
  • Consider sending mail in batches. E.g. you notify users of a new forum post, then don't send out a mail to everyone each time someone posts, offer the possiblity of daily digests.
  • As others have pointed out, use threading to send a high amount of mail
like image 178
gabor Avatar answered Sep 28 '22 12:09

gabor


You probably want to spawn this stuff out in batches, so everything is not being sent from one process in a continuous loop. You can do this much quicker if you group the batches by 25 e-mails and spawn say 50 threads to send those 25 queues. Given your 10,000 e-mails it would only take 8 loops to complete the whole batch of e-mails.

You can obviously change these numbers, but you will need to split this up in to multiple threads that send a group of e-mail. It will be up to you to find the optimal numbers of this process.

like image 27
Nick Berardi Avatar answered Sep 28 '22 12:09

Nick Berardi