tags:

views:

877

answers:

5

Hi,

I want to build an application that will allow my customers to send marketing information by e-mail. This will be a carefully monitored tool used for legitimate bulk mailing only. It's going to have all of the necessary 'unsubscribe' functionality etc.

The solution will be built using VB.NET.

My question relates to the best way to actually send the e-mails. We have an SMTP server in our data centre which we can use. I'm thinking we could write some kind of multi-threaded windows service to monitor a database of e-mails to send, then make calls to the System.Net.Mail API to send through this server.

Is this going to give me the level of performance I need to send mail to thousands of users in a sensible time frame?

If not, should I be looking at doing things at a 'lower level', performing DNS lookups in one thread, sending direct to the relevant server on port 25 in another thread, etc?

Any pointers would be appreciated!

+1  A: 

The question is not precise enough but I will attempt to answer it anyway. There are a few factors limiting you're options. The best "way" is really up to your circumstances. What deadline are you working against?

Implementing a large, low-level, multi-threaded mail-sending system will take a lot of time compared to the other option you mentioned. Sure, writing the whole thing from scratch is far more elegant than using the SMTP server and the .NET library for sending the mails.

There is also the matter of the bandwidth between the different data. Will the .NET app and the database be running on the same server as the SMTP? If not, how will the pipeline of bandwidth limit the maximum of mails sent per second?

Personally I am a big fan of keeping it simple. Reusing available software is a smart move if the clock is ticking. How often will you be sending thousands of mails? That interval will define if the time frame is sensible or not. Is it so small that you could end up with the system still working on the first "batch" when another version is ready to be sent out?

gonegonegone
+3  A: 

Similar questions asked on StackOverflow:

How do I send bulk mail to my users in a generic fashion?

Good email service for bulk emailing

Jason Jackson
A: 

Not really an answer - but an update for anyone interested... I'm currently looking at a product called ActiveMail from ActiveUp.

This seems to be an MTA (performing its own MX lookups and sending the mail directly), and it comes with a multi-threaded queuing application.

Chris Roberts
A: 

First off get a component to do the heavy lifting. I would recommend: aspnetmail

Then setting up bulkmailing is as easy as downloading some example code.
WebMailer: Sending 1000s of emails from a web page without timing out.

The same vendor also supplies mx record checker / bounce mail checkers etc. This solution isn't free but the time you save not chasing bugs / inconsistencies in the standard mail component will make this worth your while.

Oh and if you want a bulk mailer which sits on the desktop that is also supplied: http://www.aspnetemail.com/rapidmailer/

Mischa Kroon
+1  A: 

I think it's not that difficult to roll something like that on your own. It would take a day or so to build. But you should be much better off using something existing.

Still, some things I found important when doing Bulk-Email:

Don't use your own SMTP to send those.

Lookup the MX entries for your recipients and connect the SMTPClient to their SMTP, this gives you the benefit that you get an instant error msg back when the mailbox is not found or something else is wrong, and you don't stress your own server.

There was also a little bug in SmtpClient that gave me trouble because the hostname isn't a fully qualified domain name (as requested by the SMTP spec) but the machine name (and that's an internal field inside SmtpClient). Some SMTP servers take that seriously and want a domainname instead, so I ended up setting that field with reflection to a FQDN. (Hopefully this was changed since)

Tigraine