How to develop and test an app that sends emails (

2019-01-05 07:52发布

I have a lot of apps that send email. Sometimes it's one or two messages at a time. Sometimes it's thousands of messages.

In development, I usually test by substituting my own address for any recipient addresses. I'm sure that's what everybody else does, until they get fed up with it and find a better solution.

I was thinking about creating a dummy SMTP server that just catches the messages and dumps them in a SQLLite database, or an mbox file, or whatever.

But surely such a tool already exists? How do you test sending email?

9条回答
叛逆
2楼-- · 2019-01-05 08:08

This is similar to the smtp4dev except implemented in java so it works for non-windows developers.

http://www.aboutmyip.com/AboutMyXApp/DevNullSmtp.jsp

查看更多
We Are One
3楼-- · 2019-01-05 08:09

You can also use netDumbster.

http://netdumbster.codeplex.com/

查看更多
干净又极端
4楼-- · 2019-01-05 08:10

I faced the same problem a few weeks ago and wrote this: http://smtp4dev.codeplex.com

Windows 7/Vista/XP/2003/2010 compatible dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

查看更多
乱世女痞
5楼-- · 2019-01-05 08:15

There is also Papercut and Neptune, too bad none of these can be run in a portable way.

查看更多
啃猪蹄的小仙女
6楼-- · 2019-01-05 08:17

I've been using "Test Mail Server Tool" from ToolHeap for years.

http://www.toolheap.com/test-mail-server-tool/

It is a simple app that runs in your system tray and dumps emails to a folder. It can also be configured to open each email in your default mail program.

查看更多
地球回转人心会变
7楼-- · 2019-01-05 08:23

A few ago I came across the following solution for the .NET platform.

<system.net>
  <mailSettings>
    <smtp deliveryMethod="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation="C:\TestMailMessages\" />
    </smtp>
  </mailSettings>
</system.net>

Simply place the above code in your App.config or Web.config. When you send a message now it will be stored as a file in the directory you provided as "pickupDirectoryLocation". Works like a charm.

查看更多
登录 后发表回答