Lets take a look at using Papercut as SMTP-server during web site development. We’ll also take a look at StateServer. These tools works for any ASP.NET MVC-project but this post is a continuation of the Installing Litium Accelerator post.
1. Papercut
Papercut will act as an SMTP-server and will display every email sent from the website we are building. This is how the creators of Papercut explain it:
Papercut is a 2-in-1 quick email viewer AND built-in SMTP server (designed to receive messages only). Not only does it not enforce any restrictions how you prepare your email, but it allows you to view the whole email-chilada: body, html, headers, attachment down right down to the naughty raw encoded bits. Papercut can be configured to run on startup and sit quietly (minimized in the tray) only providing a notification when a new message has arrived.
Download and install the latest release of papercut and start it.
Now open up web.config of your project and change this:
<smtpServer value="" username="" password="" enableSsl="false" />
To this:
<smtpServer value="127.0.0.1" username="" password="" enableSsl="false" />
Next start your site (mine is accelerator.localtest.me) and log in to Litium. Once logged in go to Settings -> Websites -> Websites. Then edit your site and update the Sender email address to an address of your choice.
Save the settings and order something from the accelerator and you will see an order confirmation email show up in Papercut.
2. Using StateServer sessionstate
By default the site is setup to use InProc mode. This is fine, But every time the site gets restarted the sessiondata will be lost and we loose information about the cart for example. If we change this to StateServer we save some time every time we rebuild the project since the cart will be saved in our StateServer instead.
Open web.config and change this:
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" />
To this:
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" />
Then start the services app and start the ASP.NET State Service.
If you do not you will get this error: