Pages

Search This Blog

Wednesday, November 30, 2011

How to test Emails delivery on a developer server box, where outgoing emails are blocked

-   In many business cases, there is every now and then a requirement to send emails to administrator or users of the system.
-   At times, the outgoing emails are blocked on the dev boxes / servers, which hamper testing the email module in the application.
-   There is a workaround, to preview the outgoing email at the local dev box along with all the body, subject, recipients etc.

In the Web.config file for the application, place the following entries within the <system.net> section.

<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="c:\Mails" />
</smtp>
</mailSettings>
<defaultProxy>
<proxy autoDetect="true" />
</defaultProxy>
</system.net>

The mail will be stored as a Mail message in the folder specified in the web config file, through which we can verify the contents and detail of the mail.

No comments:

Post a Comment