Unable to send e-mail without local SMTP server

by: Ted Nyberg (Hallvarsson & Halvarsson)

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


Comments

  1. Thanks. This helped. Default with EPiServer installation you get: Remove from="locahost" if you don't have a local smtp server on the webserver.
  2. Default with EPiServer installation you get: &lt;smtp from="localhost" deliveryMethod="Network"&gt; &lt;network .. /&gt; &lt;/smtp&gt;
  3. However it does not help when you get that error and SMTP is configured on that server with Network Service, ASPNet and IUSR all having full control over mail root directory. No one seems to be able to resolve this.
Post a comment    
User verification Image for user verification  
Ted Nyberg (Hallvarsson & Halvarsson)

About me

I work for the corporate communications consultancy Hallvarsson & Halvarsson as a technical project manager and software architect.

Live Messenger

Hallvarsson & Halvarsson logo
 MCPD, MCTS and MCP logos

Bloggtoppen.se


Syndications


Archive


Tag cloud

EPiTrace logger