You could make quite a few of your email scripts using unit tests and breadboard mail implementations. For example, you can create an interface for and a wrapper around the SmtpClient class. This shell should implement the interface. Use dependency injection to provide the dependent SmtpWrapper class (as an interface) to the class that uses it. In your unit tests, you can provide the layout of the interface instance to the class you are testing and make sure that it correctly sends the messages expected to the recipients you expect, given the test setup.
In the end, you will have to run some integration tests, but probably a lot less. In your integration tests, you can use your test SMTP server. Given that most of your tests run in unit testing with your mock implementation, this may be enough to prevent your corporate mail server from identifying your test server.
source share