title: Delay send emails using MailMessage and SmtpClient or MessageQueue
body: <p>I am using <code>SmtpClient</code> and <code>MailMessage</code> to send emails from <code>ASP.Net</code> code.
  I want to be able to <strong>delay</strong> the delivery of emails based on business logic. 
  I will be able to generate a <code>DateTime</code> object about when the email should actually be delivered.</p>
  
  <p>I am aware that I can create a <strong>Windows Service</strong> to schedule email delivery using <code>Sql Server</code> database as an email storage. But I do not want to deploy an extra service on the hosting server.</p>
  
  <p>I am also aware that I can create a <code>SQL Server</code> job to achieve this, but I would not like to, until and unless, this cannot be achieved using pure <code>ASP.NET</code></p>
  
  <p>A point to note is that, my code checks whether <code>MSMQ</code> is enabled on the server. If it is, <code>MessageQueue</code> class is used for email delivery. So any pointers on achieving this using queues will be helpful.</p>
  
  <p>By the way, the solution should work in both cases (i.e. with <code>SmtpClient</code> as well as <code>MessageQueue</code>.</p>
  
  <p>I have already reviewed <a href="https://stackoverflow.com/questions/5161247/c-net-best-way-to-queue-emails-with-attachments-for-sending">this</a> and <a href="https://stackoverflow.com/questions/4973976/good-examples-of-applications-using-message-queues">this</a> questions and its accepted answers. I do not want to use 3rd party products until and unless this cannot be achieved using pure <code>ASP.NET</code></p>
  
  <p>P.S. .Net Framework version : 3.5, IIS 7 and Sql Server 2008 should be the environment.</p>