tags:

views:

654

answers:

9

Are there any free SMTP servers that just accept the mail sent through them, and save it to your hard disk, without sending it to the recipient. I would like to use this for testing my applications. Instead of just waiting around for the mail to go through, it would be nice if all emails could just be dropped in a folder, so that I can look at them. I could put some hooks into my program to just save instead of sending the message, but I don't think it's a full test, if the code follows a different path. Are there any existing applications like this?

I figure this would be really helpful, because you could test the mail abilities without needing to wait for the mail server to deliver it, and so that you can code while you're offline, and don't have access to an actual mail server.

[EDIT]

I'm specifically using .Net, but I'm not using the default SMTP mail handling classes in .Net, because of how limited they were in .Net 1.1. We are using a third party library (chilkat). I know that things have changed since then, but the code is stable and works, so no point in rewriting against the .Net API now.

I would like something that works as an SMTP server specifically because I could use it in the future for whatever projects I worked on, no matter the language.

+6  A: 

Hi Kibbee

You can use the standard smtp settings in your app or web.config and just specify what folder you want the emails to go.

<smtp
  deliveryMethod="specifiedPickupDirectory" 
  from="from address">
  <specifiedPickupDirectory>Your folder here</specifiedPickupDirectory>
</smtp>

This allows you to simply store the emails without an smtp server

Ray Booysen
The idea is to get a test of the app as close to its nominal usage as possible. So unless that is the configuration to use in production it would be better to use a catch all smtp server
AnthonyWJones
Good idea. However, I'm not using the .Net mail handling classes (although I'm working in .Net), so I don't think this will work for me.
Kibbee
Hi Anthony. because its nice and declarative and you're not testing SMTPClient who cares on the implementation? As long as you trust the .NET framework to work, it shouldn't matter.
Ray Booysen
A: 

Don't know about such "fake" SMTP servers, but in .NET you can force SmtpClient class to save outgoing mail to the specified directory.

Anton Gogolev
+2  A: 

On windows you could use IIS server's default SMTP server. Add an alias to its domain for * (wildcard) should cause it to drop all mail forwarded to it into its drop folder.

AnthonyWJones
+2  A: 

It's fairly easy to do in sendmail or postfix - just configure the local delivery agent to be 'cat >> file'.

Paul Tomblin
+1 Postfix is also fairly easy to set up and IIRC comes with cygwin.
ConcernedOfTunbridgeWells
A: 

I have one that does this. It's a real SMTP server, listens on port 25, and just creates mail files from the envelope data and the raw message sent in... It supports RFC 821 (well, 99% of it), but not a helluvalot more...

I assume that's what you are looking for... And, what's cool is mine supports RBL, and Grey Listing too. So, you COULD set it up to not accept some messages, or what not. But, I'll tell ya, it does not have a lot of fancy configuration, and it's pretty stripped down...

Some of the other suggestions here using Sendmail, etc might provide you with a much more COMPLETE SMTP implementation, but this one works for my testing, AND when I want to just get the RAW SOURCE of messages, and not the mangled message that Outlook, or other programs want me to see.

LarryF
Any way I could get this one?
Kibbee
A: 

Anthony,

What do you mean "Add an alias to it's domain for * (wildcard)"? I'm not real familiar with the SMTP configuration in IIS.

LarryF,

Where can I get your SMTP server?

I've got a similar need/requirement to Kibbee's.

Many thanks!

RichL
+1  A: 

bit late on this one, but have you tried ssfd?

you can put it on your machine or on a network server, catches e-mails and pops them in a directory

Anthony Johnston
A: 

There is the python DebuggingServer as well part of the standard library :

http://docs.python.org/library/smtpd.html#debuggingserver-objects

it will print everything on stdout.

Chmouel Boudjnah
+1  A: 

Taken from this question.

Alix Axel