Send mail in development environment

Just realized that in web.config you can specify a directory to “send” mail to instead of using a smtp-server, pretty neat. Just change to the following where you specify the smtp settings and you won’t have any troubles with smtp-servers. Just don’t forget to change this when you really need to send a mail.

<system.net>
   <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
         <specifiedPickupDirectory
             pickupDirectoryLocation="c:\directory\to\emails\" />
      </smtp>
   </mailSettings>
</system.net>

Tags:

  1. Olle’s avatar

    Nice, does this work with EPiServer Mail?

  2. Erik Nordin’s avatar

    I guess you can use it when sending test-mail by, but not if you want to send it to using the real EPiMail-functionally cause those are sent from EPiServers own servers.

  3. Lars Øyvind Bodahl’s avatar

    Yup, really useful setting. Use Windows mail to open the generated files :)

  4. Morten’s avatar

    Another convenient option is to use smtp4dev available at codeplex
    Then you get a nice little systray application that pops up whenever you send an email from your local server, just specify localhost as your smtp server in web.config.

Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>