DNN websites, modules, skins and support

Menu: Blog

Testing DotNetNuke emails in your development environment

By:
DotNetNuke normally sends out email on numerous occasions.
In your development environment you mostly don't have an email server set up so these emails are not really sent.
In some cases I do need to view / check these emails.

This might be to test the templates of an email module, to test localization of the emails DotNetNuke sends out on registration or as password reminders etc.

The easiest way I have found is to allow me to check the emails DotNetNuke sends is by adding a section to web.config.

In there you can set the smtp deliveryMethod to "SpecifiedPickupDirectory" and specify the folder where the emails should be "delivered".

This is what I have in my web.config

<system.net>
        <mailSettings>
                <smtp deliveryMethod="SpecifiedPickupDirectory">
                        <specifiedPickupDirectory
                          pickupDirectoryLocation="E:\_Mail\DNN6Dev"/>
                </smtp>
        </mailSettings>
</system.net>

This section should be a child of the "configuration" element in web.config.
I inject it after the "system.web" section (More info on MSDN)

I have a folder set like this for each development installation, as that makes it much easier to see from which installation the email was sent.

In DotNetNuke you have to set the SMTP server to 127.0.0.1 (in Host > SMTP Server Settings) and the emails will be delivered in the specified directory as  *.eml files.

These file you can open with your email program to check their content.