<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nagarro Blog &#187; Testing</title>
	<atom:link href="http://www.nagarro.com/blog/category/concepts/testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nagarro.com/blog</link>
	<description>Nagarro blog: software development, design, architecture and usability</description>
	<lastBuildDate>Wed, 30 Jun 2010 19:17:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A better way to test email sending functionality is to use your own SMTP Server</title>
		<link>http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/</link>
		<comments>http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 07:09:14 +0000</pubDate>
		<dc:creator>Vaibhav Gadodia</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools and Utilities]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[SMTP Server]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/</guid>
		<description><![CDATA[A large number of applications today have some kind of a notification mechanism built-in. More often than not, an email is used to send these notifications. Typically, while developing these applications, developers use their own inbox to send notifications to. Or they setup some dummy account to send test emails to; or sometimes they might [...]]]></description>
			<content:encoded><![CDATA[<p>A large number of applications today have some kind of a notification mechanism built-in. More often than not, an email is used to send these notifications. Typically, while developing these applications, developers use their own inbox to send notifications to. Or they setup some dummy account to send test emails to; or sometimes they might send test mails to real users (it&#8217;s been known to happen).<span id="more-335"></span></p>
<p>There are many limitations to this approach:</p>
<ul>
<li>one has to deal with dummy messages arriving in the inbox, when all that you want to test is your email sending code.</li>
<li>automating the testing of the email sending code will result in a large number of emails being generated and delivered to your inbox.</li>
<li>code that is supposed to deliver large amounts of email will generate a lot of load on the Internet bandwidth (and yes that can be a problem).</li>
<li>if you are testing on a copy of a production database, you might inadvertently end up sending test emails to real users.</li>
</ul>
<p>There are other issues present as well. One solution to solving these problems is to use your own SMTP server to handle all these emails in a manner that it receives an email and doesn&#8217;t sent it forward. So, it is like a dummy SMTP server. But setting up an SMTP server is usually a hassle.</p>
<p><!--more--></p>
<p>There are plenty of options out there which make your job much easier than you think it is. In this post, I am going to list some solutions which can be used (though there are many more). The basic premise behind this approach is to run a local SMTP server (either on the developer box, or the test server, or both, or somewhere on the LAN). This local SMTP server address is what is configured as the server address in your application which is being tested. Any mail sent to such a server is kept with the server and not forwarded, thus preventing all the above listed issues.</p>
<p>Following are some of the more popular out-of-the-box programs that can be used (click on the names to go to their websites):</p>
<ul>
<li><a href="http://invalidlogic.com/papercut/"><strong>Papercut</strong></a><strong> </strong>- this is a simple windows application which will run in your System Tray and simulate an SMTP server; it receives and stores any messages it receives. It allows you to view the messages. It sits in your system tray and alerts you whenever a new message arrives.</li>
<li><a href="http://www.donovanbrown.com/post/2008/10/20/Neptune.aspx"><strong>Neptune</strong></a><strong> &#8211; </strong>this is another application which will do a similar task. It is however a little more advanced. It has an admin API interface which allows you to run custom queries to analyze the messages that it processes. It doesn&#8217;t have a UI through which you can view the received message though &#8211; but sometimes all you need to check is if the messages are being delivered. Very useful in a bulk messaging scenario.</li>
<li><a href="http://smtp4dev.codeplex.com/"><strong>smtp4dev</strong></a> &#8211; this is another option similar to Papercut, which again sits in the system tray and will let you know whenever any message arrives and will let you look at the message details.</li>
</ul>
<p>There are many more out there which can be used to do similar things with some features here and there (for example, Neptune doesn&#8217;t generate all SMTP responses). Here&#8217;s a post by Phil Haack from long ago which is also interesting: <a href="http://haacked.com/archive/2006/05/30/ATestingMailServerForUnitTestingEmailFunctionality.aspx">A testing mail server for unit testing email functionality</a>.</p>
<p>So, when you feel the need to test your email sending code the next time, it might make sense to have one of the tools (or something similar) available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
