Testing SMTP with .net

后端 未结 17 1245
[愿得一人]
[愿得一人] 2020-12-04 09:54

I need to configure a SMTP server for testing my website which sends emails (for registration confirmation etc).

I dont actually want the email to be sent, I just w

相关标签:
17条回答
  • 2020-12-04 10:32

    I think the blog post A Simple SMTP Server Mock for .NET gives you what you need: a SMTP server mock

    A SMTP server mock is basically a fake SMTP server which can be used for unit testing of applications which send email messages.

    Also, a google search for smtp mock server will provide you with a selection of SMTP servers for testing purposes. Like:

    • Dumbster - Java fake SMTP server
    • nDumbster - .NET port of Dumbster
    0 讨论(0)
  • 2020-12-04 10:32

    You can use Mailnest.io as it is an affordable and yet very effective tool for email testing. It also has a free forever plan for limited usage.

    0 讨论(0)
  • 2020-12-04 10:36

    Note that the SmtpClientWrapper class proposed by tvanfosson needs the all-important "virtual" keyword in its declaration of the Send method, otherwise you are back in the same boat as trying to Mock the SmtpClient directly.

    0 讨论(0)
  • As per many of the other suggestions a free tool I've used quite a lot: http://www.toolheap.com/test-mail-server-tool/

    Not really for TDD but useful in manual testing as it can pop up an outlook express window with each email that would be sent.

    0 讨论(0)
  • 2020-12-04 10:46

    I found this - http://improve.dk/archive/2010/07/01/papercut-vs-smtp4dev-testing-mail-sending-locally.aspx which explain how to use papercut and smtp4dev which are both good tools

    0 讨论(0)
  • 2020-12-04 10:46

    If you are on Mac OS X you can use MockSMTP.app

    0 讨论(0)
提交回复
热议问题