tags:

views:

35

answers:

3

I run my development environment in a VM and need to test the delivery and appearance of emails from my applications. The problem is when my SMTP server starts delivering a lot of mail to my corporate email account, the server is soon rejected as a source of spam. Of course, the major Internet email providers will also never accept email from such a server.

One solution with a problem: I've delivered to a to a file folder using the .NET SpecifiedPickupDirectory option and open in outlook express, but the problem is that VALID images always display as broken images.

A: 

To avoid your email being flagged as spam, you will have to talk to the system administrators that administer the corporate email servers. They are in control of how spam is flagged in the system and may be able to exclude your emails.

You are mention an issue with broken images, but this has nothing to do with spam and would perhaps be better as a question of its own (with appropriate title).

Oded
Controlling spam settings on the corporate server is not an option in my situation.The broken images problem is directly related to one solution I tried. It is not a problem with broken images, but a problem with the way .eml files are formatted and displayed in outlook when using the .net SMTP SpecifiedPickupDirectory option.
Micah Burnett
+1  A: 

You could do quite a lot of your email scenarios using unit tests and a mock mailer implementation. For example, you can create an interface for and a wrapper around the SmtpClient class. This wrapper should implement the interface. Use dependency injection to provide the dependent SmtpWrapper class (as the interface) to the class that uses it. In your unit tests, you can supply a mock instance of the interface to the class under test and ensure that it is correctly sending the messages that you expect to the recipients that you expect given the set up of the test.

Eventually, you will have to run some integration tests, but probably much fewer. In your integration tests you can you use your test SMTP server. Given that most of your tests are run in unit testing with your mock implementation, this might be enough to keep your corporate mail server from misidentifying your test server.

tvanfosson
+1 Completely agreed, developer should not test mail delivery. He should test only the fact that the message is sent.Format of the resulting emails can be tested without actually sending them.
newtover
+3  A: 

Your answer: Papercut, an open source pseudo-SMTP test server. This is the ultimate dev email testing app that is a must have.

Jaxidian
FANTASTIC!!!!!! This is exactly what I needed.
Micah Burnett
+1: needed this too!
Michel