开发者

Why would you send email in a batch instead of sending individually?

开发者 https://www.devze.com 2023-03-27 01:24 出处:网络
We have a Windows Service to check if certain conditions are met, we will send an email to the customer. We will have abou开发者_开发问答t 50 emails to send everyday. My question is, is it better to s

We have a Windows Service to check if certain conditions are met, we will send an email to the customer. We will have abou开发者_开发问答t 50 emails to send everyday. My question is, is it better to send emails out individually (i.e. every time the condition is met, triggers sendmail function) or queue all the emails and send in a batch? Is it better to send in a batch because of performance reasons? But we only send about 50 emails a day so it doesn't matter too much? How would you queue the emails if the emails should be send in a batch?

Many Thanks


Generally the reason for batching multiple e-mails into a single e-mail is so as not to irritate the recipient, rather than for performance reasons. 50 e-mails throughout the day can be very annoying and will quickly cause the recipient to "tune out," whereas a single e-mail containing all pertinent notifications may be easier to digest.

As to how to re-queue the e-mails, it would be best if you could modify the service itself to store the outgoing e-mails in a file or buffer and only send the contents of that file or buffer once a certain threshold has been reached - be that a time threshold or a size threshold.


If you're only sending 50 emails a day, the point is entirely moot.

In terms of the actual server, SMTP doesnt care if you send in batch or individually, it is just working through an email backlog queue to send out.

The only real concern should be if you need to continously query your DB for emails to send, or if you want to query your DB for batches of email to send (to cut down on DB queries).


Ignoring performance, there's another thing you need to keep in mind: does the user need that e-mail as soon as the condition is met? If so, don't even consider queueing the messages unless you're emptying the queue on a nearly constant basis.

Otherwise, it's really up to you. 50 e-mails a day isn't going to break your server, so I wouldn't worry about performance. On the other hand, if it's convenient for you and your users to send the e-mails in batches, go for it.

0

精彩评论

暂无评论...
验证码 换一张
取 消