Announcement Announcement Module
Collapse
No announcement yet.
Testing E-mail Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing E-mail

    Hi, everyone

    One of the things I like about Dependency Injection is how easy is to test the application. Specially when you use interfaces, it´s just a case of mocking the interface. I have an issue about testing sending e-mail. When you´re using Spring MailSender interface this is quite simple. But when you have to send MimeMessage's you have a problem, because JavaMail use classes instead of interfaces. How do you test e-mail in your applications? I've read about creating a mock smtp server, but I hope there is a more easy alternative.

    Rgds,

    Rui

  • #2
    I have been using the Dumbster mock SMTP server to test my email:

    http://quintanasoft.com/dumbster/

    It is lightweight enough to be used with junit.

    Comment


    • #3
      Have you looked at jMock's cglib extension which allows mocking concrete classes?

      Comment


      • #4
        Thanks Patrick.

        Dumbster is really cool.

        Comment


        • #5
          instead of Dumbster is better to use org.subethamail.wiser.Wiser

          Originally posted by Patrick Bourke View Post
          I have been using the Dumbster mock SMTP server to test my email:

          http://quintanasoft.com/dumbster/

          It is lightweight enough to be used with junit.
          I went through a lot of pain using Dumbster until I discovered a Dumbster replacement written by someone who got frustrated with the bugs in Dumbster.
          Below is the comment I placed in the program I wrote that originally used Dumbster:

          * The first version of this program used the open source Dumbster mock mail server.
          * However a robust, well-written open source alternative was later found and the program was re-written to use org.subethamail.wiser.Wiser instead of Dumbster.
          * Wiser, according to their web site, is quote, "a smart replacement for Dumbster".
          * For more information see: http://subethasmtp.tigris.org/wiser.html

          Comment

          Working...
          X