Sending a mail only Per a day

Posted by Shoyebaziz123 under ASP.NET on 8/18/2011 | Points: 10 | Views : 916 | Status : [Member] | Replies : 3
Hi All,
I have make an application for sending mail,
there is some requirement that is if less than 5 days remainig for particular
adds than a mail is send to the user.

I have done all of thing, works well, but there is a problem that i am calling
this page on page load, so the mail is send each and every time when the page get refereshed.
How i can stop this... that is if the mail is sent for today there must no other mail to be send....is there any Logic ?

Thanks




Responses

Posted by: Jpchoudhari on: 8/18/2011 [Member] Starter | Points: 25

Up
0
Down
you can store LastReminder field to store the datetime when last reminder was sent and you can check this against current date.

Kind Regards,
Jay

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 8/18/2011 [Member] Starter | Points: 25

Up
0
Down
if you are storing email notification details into database including sent datetime for that particular add then add condition to fetch only those records which satisfy the following condition.
(CAST(CAST(LastReminderSentDate As Decimal) As DateTime)=CAST(CAST(GETDATE()As Decimal) As DateTime))
add above condition in addition to your exsting logic..

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 8/18/2011 [Member] Starter | Points: 25

Up
0
Down
sorry..changed condition from = to <>
if you are storing email notification details into database including sent datetime for that particular add then add condition to fetch only those records which satisfy the following condition.
(CAST(CAST(LastReminderSentDate As Decimal) As DateTime)<>CAST(CAST(GETDATE()As Decimal) As DateTime))
add above condition in addition to your exsting logic..

Shoyebaziz123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response