I'm going to recommend using the ON SENDFAIL event.

As a sidenote, please remember that filesharing is not officially supported on these forums.