Sending Reminder Mails to Clients from Database Mail

  • Hi,

    I need to send mails using Database mail to clients whose balance is less than $2000 .

    Say I need to schedule the first reminder for clients whose balance is less than $2000 at 0900 hrs & than later in the evening i need to send reminder for clients if the balance is less than $2000 at 1800hrs. Now the issue is that if the client has been sent an email in the morning then he should not receive the mail in the evening.

    The table fields are :

    clientid

    clientname

    email

    balanceamount

    How can I do this ?

    Regards,

    Nithin

  • home work?

    I wrote a procedure very much like what you describe here. I'm not sure what your constraints are, but the way I did it was with a column tracking the "lastsenddatetime" or something like that. So each time you run a "check balances" procedure, you check both the balance and the lastsenddatetime. If balance is below threshold, and lastsenddate is older than threshold, send and email and update the lastsentdatetime. that was my approach.

  • For this you have to create job in SQL server which check the balance from table and get the email of that client.

    You have to schedule job for moring 9 and evening 6.

    After sending email you have to set one flag for it in one temp table it will truncate every day.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply