Method for email testing

后端 未结 14 1655
眼角桃花
眼角桃花 2020-12-24 01:56

I am writing a program that will be emailing reports out many (~100) clients which I want to test before I spam everyone.

I want to do a test run against my producti

相关标签:
14条回答
  • 2020-12-24 02:32

    For .NET I set the config file to deliver mail to a folder, then you can have the automated test inspect the directory and files.

    <system.net>
     <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
       <specifiedPickupDirectory pickupDirectoryLocation="c:\pickupDirectory"/>
      </smtp>
     </mailSettings>
    </system.net>
    
    0 讨论(0)
  • 2020-12-24 02:32

    Exim can be configured to accept incoming mails but not deliver them. Look for the keywords queue_only and queue_only_file in the documentation.

    0 讨论(0)
  • 2020-12-24 02:34

    Sendmail has a Test Mode.

    You just invoke sendmail with the -bt parameter. As an example:

    /usr/lib/sendmail -bt -Ciu-testconfiguration.cf

    Please be aware that in this method, Sendmail requires an special configuration on rewrite rules. You need to understand how Sendmail rewrites addresses in order to properly create a .cf file for Test Mode.


    Edit: See this article: http://ussg.iu.edu/usail/mail/debugging/

    0 讨论(0)
  • 2020-12-24 02:34

    Post Hoc is a pure Java application that looks exactly like an SMTP server to the application you are testing, but it simply collects all the email messages and allows you to inspect them using a web interface.

    Freely available at: Post Hoc GitHub Site

    For more information: PostHoc: Testing Apps that Send Email

    0 讨论(0)
  • 2020-12-24 02:35

    "The Wiser framework for unit testing mail"

    I've heard of a few other developers moving from Dumbster to Wiser and have migrated my testing code as well. One of the Java components that I've worked on sends thousands of emails a day and I've written unit tests for the different email templates and scenarios using Dumbster and Wiser. I prefer Wiser.

    Snips from the Wiser website (http://code.google.com/p/subethasmtp/wiki/Wiser):

    Wiser is a smart replacement for Dumbster and is built on top of the SubEtha SMTP Java library which allows your Java application to receive SMTP mail with a simple, easy-to-understand API.

    0 讨论(0)
  • 2020-12-24 02:37

    In java you can use dumbster

    Its easy to use and you can validate every aspect of the email you are intercepting.

    It's a Java SMTP server implementation meant for unit testing. (Just make sure you redirect your email to the machine running dumbster...)


    I just found another alternative that do almost the same: Greenmail

    Greenmail also support POP3, IMAP with SSL so you can test your client against it.

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