Sending mails, development machine, without actual mail server

email1

During development, you might prefer just to write mails to a local directory, so you can see what’s
happening without having to set up an actual mail server.

To do that open web.config and add these few lines “instead of real SMTP configurations, which you will need to activate on the real server and delete/comment these lines”:

 

This will write .eml files to the specified folder (here, c:\email), which must already exist and be
writable. If you double-click .eml files in Windows Explorer, they’ll open in Outlook Express or Windows Mail.

 

 

Tim Gaunt in his below comment mentioned about a very nice tool called smtp4dev , A Dummy SMTP server that sits in the system tray and does not deliver the received messages. Useful for testing/debugging software that generates email.

This entry was posted in Technical. Bookmark the permalink.

18 Responses to Sending mails, development machine, without actual mail server

  1. This is great, I’ve got IIS set up on a laptop in my room but can never figure out how to configure an SMTP client.

  2. TomA says:

    For Django apps I have used smtp_sink.py with the same effect.

    menendez.com/…/efficiently-tes

  3. Cool tip Amr, and really nice blog you made a good job with graffiti

  4. Justin says:

    I use a free product called Papercut that acts like a local SMTP server but doesn’t send out the messages.

    invalidlogic.com/…/papercut

  5. Phil says:

    That’s fantastic. It will no doubt come in handy for live envionments too – useful for queuing mail, logging, error handlers, you name it!

    I’ve already added it to an email utility function which allows email to be globally disabled or put into 1 of 3 (now 4) test modes. 0 = Normal, 1 = Bcc test address, 2 = test address only only, 3 = SaveToPath, 4 = Disabled.

    Thanks for the post. I wonder how many other gems like this .net has hidden away!

  6. Tim Gaunt says:

    I’ve used this and Papercut in the past however we’re now using smtp4dev which is a step on from both as the issue we had was viewing the emails themselves.

    smtp4dev can be found here: http://smtp4dev.codeplex.com/ aparently v2 is on it’s way too…

    Tim

  7. Amr ElGarhy says:

    @Tim Gaunt, Thanks for sharing this nice tool, will mention about in the post body, because its an important tip.

  8. Thnaks mate,I was looking for that info nearly 2 days.You made my mails lot easier

  9. I havent any word to appreciate this post…..Really i am impressed from this post….the person who create this post it was a great human..thanks for shared this with us.

  10. oes tsetnoc says:

    Great blog, this could be the best blog I ever visited this month. Never stop to write something useful dude!

  11. That’s a very neat method for sending mails without an email server,

  12. Good trick from you. THanks mate, I’ll use this as my future reference.

  13. term paper says:

    smtp4dev is an excellent tool for quick, easy email testing. I can’t believe how easy it was to specify localhost as my email server in web.config, launch smtp4dev, and start testing the notification process for a data-driven app I’m working on. I can see who all will get notifications at a glance without spamming them with test mail.

  14. Aldi says:

    I’m still dont understand, but thanks for sharing

  15. Term paper says:

    I like your post!I didn’t know about tool smtp4dev,thanks, it is really helpful.

  16. lean blog says:

    I do not know that that is possible. Actually we are using mail server as of the moment.

  17. This seems to be a good option if you are sending out mass emails from just one server. I need to show this to my boss for approval.

  18. I think I need this one. I do have a question, is this also possible if I am using a free email account? Like Yahoo or Gmail?

Comments are closed.