Several times a month, I'm faced with the task of sending meeting notices to members / potential members of the Detroit Chapter of the Indepdent Computer Consultants Association. At first, I was simply pasting the names into Outlook and sending the notices. Obviously, that sucked for several reasons...
So, a few months ago, I wrote this very short (45 lines) console application to handle all the dirty work for me (as well as some improvements over creating a single email in Outlook).
The app works like this:
1. Reads the app.config file to find the name of the “content” file to send. In my case, it's an HTML page.
2. Slurps the contents into a string variable.
3. Grabs the DSN from the app.confile file.
4. Uses the Microsoft Data Access Application Block to select the first name, last name, email address from a table in my SQL Server.
5. Loops through each record in the dataset and sends the email, personalizing each email before it sends.
Is this rocket science? Nope. Is it handy as all get out? Yep.
This .zip file contains the .cs file, the app.config file, the .sql file to create the table and a sample content file (.txt). It also contains a Nant build file.
Please note: I do NOT use this to spam people. Everyone that I send to has opted-in to our list.
Please note: This isn't as robust as it could be simply because I use this in a very controlled environment.
Please note: Use this at your own risk. I cannot and will not be held responsible for the use or mis-use of this code.
Print | posted on Tuesday, June 15, 2004 4:56 PM