Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delaying the sending of emails in C#

We are writing a feature to send a reminder email to customers in x number of days and just wondered if it was possible to delay the sending of the emails similar to how you can in Outlook (New Mail > Options button > Do not deliver before) in C#.

Does anyone know of a way of doing this?

like image 891
Chris Knight Avatar asked Feb 17 '09 12:02

Chris Knight


People also ask

What causes delay in emails?

Email delays can be attributed to the size of the email and its attachments, network latency, or occasionally issues with spam/virus scanners getting backed up. Most often, it's a case of sender or recipient client delays. Many mail clients only communicate with the server to send or receive new mail every few minutes.

What does delayed delivery mean in email?

One that people often miss is “Delayed Delivery”. This feature allows you to compose an email to be sent at a later date or time as you wish, which is great for sending reminders, emailing at specific times, or lowering exceptions on your response time.


1 Answers

If you want to submit the email to an SMTP server to hold for a number of days, the server would have to support this feature. I would recommend against doing it that way, however. If you had a problem with missing emails it could be hard to track down.

Here's what I would do:

  1. Schedule the emails in your system by making a table entry.
  2. Include a "SendDate" column in the table where you can set a date in the future
  3. Write a Windows service that wakes up once every 15 minutes (for example) and sends the emails in that table where SendDate < currentDate
like image 174
Dave Swersky Avatar answered Oct 26 '22 12:10

Dave Swersky