troubleshooting Question

How can I send up to 5 people and email alert that a contract is about to expire?

Avatar of David Megnin
David MegninFlag for United States of America asked on
C#Microsoft SQL Server 2008SQL
20 Comments1 Solution157 ViewsLast Modified:
Our company has many, many contracts, with responsible persons in multiple departments of our company.

I'm tasked with developing a database of these contracts and their expiration dates and a system where alerts are sent to up to 5 people when a contract is within 90 days, 60 days, 30 days and 15 days of expiring. (The db and input form are done.)

So for a given contract, when its expiration date is exactly 90 days from expiration, one email is sent to the email addresses listed in the database.  Then at 60 days prior to expiration another email is sent to them.  Etc...


I've tried many solutions using sp_send_dbmail (T-SQL) and just can't find one that works for this scenario.

The first issue, I can't get multiple email addresses into the @recipients parameter from multiple table columns (email01, email02, email03, etc.)
Another issue I foresee is when more than one different contract expires on the same day, sending the appropriate messages to the appropriate recipient(s).

I'm wondering if there's a better approach, entirely; not using sp_send_dbmail.  The data input form for the table for this thing is in ASP.Net 4.0 and C# codebehind.  I could put the system in the codebehind of the input form, but that would require someone opening the form in order to trigger the check for expiring contracts.  I need the check to happen every single day.  The form may not be used for weeks at a time.

The single table has the following columns:
Company VARCHAR (100)
ExpirationDate (date, null)
email01 VARCHAR(50)
email02 VARCHAR(50)
email03 VARCHAR(50)
email04 VARCHAR(50)
email05 VARCHAR(50)

This is a huge thing for my company.  I really want to find a good solution.  It seems pretty simple, but I'm stumbling terribly on it.  Thanks in advance.
ASKER CERTIFIED SOLUTION
Qlemo
"Batchelor", Developer and EE Topic Advisor

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2015

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 20 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros