One day our TFS server stopped sending out e-mail alerts.
We first checked and rechecked our Email Alert Settings, but they were all in order.
Our next guess was our server’s access to the SMTP server had been blocked (we are in an environment where only certain machines are allowed to send e-mail messages via SMTP). But we ruled that out when we were able to send out e-mail messages with a simple test application from that server.
After much looking around on the internet and on the TFS server, we came across this error in the Tfs_Configuration.tbl_JobHistory table:
We used the following SQL query to find this:
We looked up the user associated with the GUID listed in the error message and discovered it was related to a user who had left the project a few months earlier. Their user account had been deleted from the Windows domain.
The following TFS bug appears to document the issue we were encountering:
https://connect.microsoft.com/VisualStudio/feedback/details/779506/all-tfs-e-mail-notifications-stop-because-of-any-exception-regarding-a-user-alert-or-user-identity (link is no longer valid)
Using the GUID from the error message and the SQL query below, we were able to find the alert subscription that was causing our problems:
Using the id field from the results of the query above, we were able to delete the offending subscription using the BisSubscribe.exe command shown below:
Once the bad alert subscription was deleted, the other e-mail alert notifications started to be sent.