I have used the System.Net.Mail.SMTPClient class in virtually every application I have developed. I have never had any issues with it. However, I am encountering an extremely annoying situation in which a call to SMTPClient.Send causes my production application to crash EVEN WITHIN A TRY/CATCH BLOCK, and THE EXE IS DELETED!
WTF. In the development environment there is no problem whatsoever, email is sent without a hitch.
The application is written in C# and created in Visual Studio 2010. I have a setup project which creates the setup.exe file that the app is installed with. Every time that the production app calls STMPClient.Send it crashes without warning and the EXE disappears.
I have verified all smtp settings and, as I said, there is no problem when running in the development environment.
Does anyone have any idea what could be causing this strange behavior?