Sending periodic mail according to user setting in ASP.net?

in my web application I want to send mail to users according to pre-selected periods myself.
for example: 1 HTML email in 3 days to user 01 and 1 HTML email in 20 days to user 02

how can I do this? any resources? I can send mail with my application from my Gmail account to any email addresses in my tables, but I don’t know how to send it automatically after a certain period of time (I use C # and SQL Express)
Help me!

+4
source share
5 answers

.
3 :

1 2 , , , WinService. , . , , :

    Windows ASP.NET .

- . -.

+3

-, , , cron daemon Windows.

, .

, Windows, , ​​ .

- cron . , - .

+3

,

quartz.net

Quartz.NET - , , .

Quartz.NET - Java- Java, Quartz. Quartz.NET -- cron-, .

+3

, :

1- 2 sql db, , , : LastEmailSentDate datetime SendEmailPeriod int

2- , .

// funciton

public void CompareLastSentDate()
{
   // lets assume that you bring the data for the db using Sqdatareader reader
   //get the field from the LastEmailSentDate field in the  database as i mention before
   DateTime LastEmailSentDate = Convert.ToDate(reader["DatePeriod"]) 

   // get the field from the SendEmailPeriod of the user field from database
   int sendEmailPeriod =  Convert.Toint32(reader["SendEmailPeriod"]) 

   // now you have the date before the period of day ex: before 3 days depend on user
   DateTime DatePeriod = new DateTime(DateTime.Now.Year, DateTime.Now.Month, (DateTime.Now.Day - sendEmailPeriod ));

   // if the last email send is before period of day that mean u have to send an email again
   if(LastEmailSentDate.Day <= DatePeriod.Day)
   {
      // sent the email to the user
   }

}

:

, ur__load [ "LastFunctionCallDate" ] = DateTime.Now, , ==

+2

IIS, ASP.NET, , IIS ( ) .

( , , -, 9-5), Application_Start Global.asax . .

Application_Start, , , , , .

async, async, .

+2

All Articles