multithreading - Best Way to handle Bulk Mail in C# -
what best method send bulk emails lists. e.g. user request service service category. 200-20000 matching emails users criteria , send users request recipients.
i have done research not sure best solution task.
method 1, use multiple threads enable multiple smtp clients send mails (not sure if send massive amount of recipients if kill server threads) http://www.aspsnippets.com/articles/send-bulk-mass-email-in-aspnet-using-c-and-vbnet.aspx
method 2, use service sendgrid manage emails. (i see in marketing campaigns can manage lists/contacts. not sure if can dynamically generate content template , send list) https://sendgrid.com/docs/api_reference/web_api_v3/marketing_campaigns/contactdb.html
any advice appreciated!!
you have many different ways
the first way, use , in opinion best, need use database store data , write code executed:
- create table "emaillogs" following fields
profilename, body, subject, [to],cc,bcc,isactive,queuedon,senton
- write stored procedure clearemaillogs send top 50
isactive=1
, update sentongetdate()
value - write job in sql server execute each 10 minutes
- from application, need insert bulk of messages table emaillogs
profilename: maybe need have many emails configuration send through different emails example noreply@yourdomain.com
or info@yourdomain.com
, in sql server can create profile each email want use
why send max 50 email each 10 minutes? because if send emails recipients, other companies yahoo or google...etc might block emails , send them spam or junk mails.
second way, can subscribe services, can find online, need pay money service.
hope helped you
Comments
Post a Comment