简体   繁体   中英

SMTPClient.Send crashes production application

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?

This has been resolved already through a comment, but adding an answer for future references

Check your anti-virus settings, it might not like it and remove the executable without any warnings. If you are deploying this on client's computers, make sure you purchase a Software Publisher's Digital Certificate. But if your app has been "blacklisted" you might need to take further steps, like submitting a whitelist request to the pertinent entity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM