your issue is this part:
SELECT @CAPTUREDSTRING = [DeletedItems]
FROM (
SELECT TOP 1 GETDATE()As TheDate,stuff(( SELECT ',' + Name
FROM INSERTED s2
--WHERE s2.WHATEVERID= s1.WHATEVERID --- must match GROUP BY below
WHERE 1 = 1
ORDER BY Name
FOR XML PATH('')
),1,1,'') as [DeletedItems]
FROM DELETED s1
GROUP BY s1.ConfigSetID --- without GROUP BY multiple rows are returned
ORDER BY s1.ConfigSetID) myAlias
and this:
+ @CAPTUREDSTRING --this has the list of values
that has to be modified to gather your specific data...and on INSERT it would return a null(there is no data int he DELETED special table)...so adding a null plus the whoodunnit string created at the bottom will return an empty email.
remove it completely, to prove to yourself it works.
then modify that to gather and return whatever data you really need to report.
hint: the data will be different for insert vs update vs delete: so make sure you modify it accordingly. build three different strings, depending on whether it is insert/update/delete is what i would recommend...plus you'l learn exactly how to modifyt he trigger so you can support it in the future.
Lowell