Unable to send e-mail without local SMTP server
When you try to send e-mail through an external SMTP server using the System.Net.Mail namespace classes, you may encounter an error saying "Cannot get IIS pickup directory".
Often this has to do with permissions, but I recently discovered another reason which pertains to the default settings for EPiServer CMS web sites.
By default the delivery method for SMTP (configured in web.config) is "PickupDirectoryFromIis". This works fine if you have SMTP installed on the web server, but if the server running the web site lacks SMTP you will receive errors.
The way I resolved the issue (since I don't run SMTP on my local development machine) was to change the delivery method for SMTP to "Network". In web.config this looks something like:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" />
<mailSettings>
<system.net>
It's important to spell "Network" with a capital "N"!
The valid values for deliveryMethod are:
- PickupDirectoryFromIis
- Network
- SpecifiedPickupDirectory
12 December 2007