This project is read-only.


This project was born out of the need to send emails from a web application. Developing on Vista presented a problem as there is no local SMTP as with Windows XP.

MailQ was created because:
  • A connection to the mail server could not always be guaranteed
  • A message should be resent if it failed
  • Needed to be able to track a message (i.e. confirm that is has been sent)

Installation Instructions

To install MailQ follow the steps below:
  1. Create a database named MailQ
  2. Execute the Create SQL Objects.sql script on the MailQ database (can be found in the MailQ.Database project under Create Scripts folder)
  3. Execute the Create Insert Message.sql script on the MailQ database (can be found in the MailQ.Database project under Create Scripts folder)

To send out the emails, a console application is scheduled to execute at required intervals. This application is in the MailQ.MailSender project. MailQ.MailSender utilises the MailQ.API library to retrieve and send emails.

There are a number of configuration settings that one can set. Currently these settings reside in the MailQ.API project's Settings file. Prior to building and deploying the MailQ.MailSender application, these settings should be checked and set as required. Settings relate directly to the System.Net.Mail.SmtpClient class properties.

Settings that need to be checked:
  1. MailQConnectionString -- This is the connection string that will allow the MailQ.API object to connect to the database. If this is not correct, no emails will be queued or sent.
  2. Server -- The SMTP server through which the email will be sent (i.e. exchange server on local network)
  3. Port -- Port on SMTP server to use
  4. UseSSL -- If a secure connection to the SMTP server should be used (Default false)
  5. DefaultCredentials -- If the default credentials should be used (Default true)
  6. Password -- Password to use when NOT using default credentials
  7. UserName -- Username to use when NOT using default credentials
  8. FromAddress -- The email address that the emails will be sent from
  9. BccAddress -- A copy of the email will be sent this address, if specified
  10. TrackMessage -- Message that is added to the bottom of the email for tracking/reference purposes. Add [messageID] tag in the TrackMessage to have the system insert the message database id for easy referencing.

To install the MailQ.MailSender application follow the steps below:
  1. Check configuration settings in MailQ.API project
  2. Compile MailQ.MailSender project
  3. Copy the executable and dll's from the bin folder to a desired directory
  4. Set up a schedule in windows task scheduler to run the executable

How to use

Adding emails to the queue can be done in the following ways:
  1. Use the EmailHelper.AddEmailToQueue method from the MailQ.API library
  2. Use the InsertMessage stored procedure

Last edited Feb 28, 2010 at 9:03 AM by hannocoetzee, version 6


No comments yet.