Reputation: 75
I'm looking for a SMTP server for windows which would help me debug email sending in my web applications. Preferably some soft which instead of sending emails would let me see them or just save them somewere.
Normally I have a flag in apps which makes them showing emails instead of sending it, but now I have to debug a large project PHP with not wrapper around email() used :/
thanks!
Upvotes: 1
Views: 512
Reputation: 3541
Just use "The Python":
Download Python 2.7 from http://python.org/, then go to command line and write:
C:\> C:\Python27\python -m smtpd -d 0.0.0.0:25
Doing this you'll be importing smptd
module and getting debug output through the console. If you don't specify an outgoing SMTP server (because using this mode it works like a proxy), any mail you try to send, will be discarded, but you'll see it into the console.
Good luck!
Upvotes: 0
Reputation: 5313
How big is the project? I'm not a big windows guy myself, but whenever I have to make some huge, widespread change to the code I'm working with, I can usually just do this from the command line:
grep -lr 'mail(' ./ | xargs sed -i 's/mail\(/Mail::send(/g'
And that replaces the mail function everywhere. I'm sure there are programs that can provide the equivalent functionality for Windows.
The reason I suggest dealing with the code rather than changing the SMTP server is because it's ultimately the more proactive method of dealing with the issue at hand. What happens if you need to scale and add more SMTP servers? What happens if you need to switch SMTP servers entirely? What happens if the SMTP server goes down and you need to save all outbound mail until it's restored? It just makes a lot more sense to take the time to do this little refactor, since I guarantee it'll save a lot of headache down the road.
Upvotes: 1
Reputation: 640
You could technically have the SMTP server send the emails to a dummy email box which would be located locally on the server's computer. This way, you can view it without it having to leave your computer. An aside; Unix kind of does this with /var/spool/mail before sending out the mail.
Upvotes: 2