views:

47

answers:

1

We would like to use Selenium to test email content generated from our website.

We could mock a mail server, but how would we assert the content of the emails?

We're using nUnit/Selenium/C#.

Does anyone have a good approach to accomplishing this?

Thanks in advance!

+3  A: 

This article by Phil Haack is great:

http://haacked.com/archive/2006/05/30/ATestingMailServerForUnitTestingEmailFunctionality.aspx

Granted you're not using Selenium with this approach so it isn't the total solution. What you could do is setup to drop emails into a directory:

http://dotnettipoftheday.org/tips/smtp-delivery-method-SpecifiedPickupDirectory.aspx

And watch the folder, then look at the email contents.

You might use something like this as well as part of your Selenium C# test code:

http://www.codeproject.com/KB/IP/despop3client.aspx

Nissan Fan
Thanks! I think we are going to go the dropmail folder route.