[RESOLVED]Sending bulk HTML Emails

I’m setting up an e-mail system that will send password reset, credit card expiring, and possibly info/promo e-mails in our MVC .net application.  Some e-mails will be sent on request, such as reset my password, but some may be sent in bulk (think 1000s),
such as credit card expiring or promos. We are using a corporate Google account, and I can successfully send a test e-mail as shown below. My question is if this is a reasonable way to handle bulk e-mails (if we are not using a third party service), or if
there is a different route I should pursue? Also, I have not tested sending 1000s of e-mails this way, so I have no idea if it will process in a reasonable amount of time via this method. Any tips would be most appreciated.

      private void TestEmail(){
            string subject = "Test from redacted.com";
            string body = "this is a sample body with html in it. <b>This is bold</b> <font color=#336699>This is blue</font>";
            string from = "donotreply@example.com";

            var mail = new System.Net.Mail.MailMessage( from, "redacted@gmail.com" );
            mail.Subject = subject;
            mail.Body = body;
            mail.IsBodyHtml = true;

            var client = new System.Net.Mail.SmtpClient( "smtp.gmail.com", 587 ) {
              Credentials = new NetworkCredential( "redacted@gmail.com", "redacted" ),
              EnableSsl = true
            client.Send( mail );

It depends on what you consider "bulk" emailing.

You have to be extremely careful if you intend to do something like this yourself as looping through a table of e-mail addresses (or similar) and sending them out within an ASP.NET application is a quick way to get blacklisted as a "spammer". You
may want to consider using an actual mail-service to handle this (unless you want to write your own Windows Service to handle sending the mail in "batches" as mentioned in this similar discussion).

Additionally, you might want to look into any explicit restrictions that your hosting provider may have in place as well (as I am sure that they don’t want any of their clients sending out thousands of unsolicited e-mails either).

Consider a Service to Handle your Bulk Mailing

You will need to look into some other methods of sending massive amounts of emails (such as performing them in batches with delays in between each batch rather than sending them all at once or using a specific service like Amazon’s
SES (Simple Email Service) which you can read about how to implement in your .NET Application here
 or MailChimp to
handle this for you
). If you have a dedicated server, you’ll want to implement the delays and batch sending through a Windows Service.

If you know that you are going to be handling sending to thousands of users, then a service is definitely the way to go (especially if you don’t have your own dedicated server).

Leave a Reply