A simple local SMTP server [closed]

2019-01-13 15:13发布

I want to test a Java code for sending email. I don't want to use any commercial mail client or connect to any external mail providers (like Gmail or Yahoo). I would like to know if there is any software which allows a user to configure dummy email addresses and server (locally) which can be used in my software to send and receive mails. I just want to test the functionality of the Java code.

10条回答
相关推荐>>
2楼-- · 2019-01-13 15:18

The javamail-file-transport saves emails to files instead of sending them through SMTP server.

See the javaMail extensions project on GitHub.

It adds file transport that allows:

  • save mails to files in text format instead of sending them
  • save mails to files in mbox format instead of sending them
  • add log info instead of sending email
查看更多
不美不萌又怎样
3楼-- · 2019-01-13 15:23

Try GreenMail. It's geared towards JUnit usage, but it should do what you need. You can run it in a JBoss instance or have your JUnit tests send mail to themselves, depending on your specific needs.

There are a few other similar bits of software out there, but that's the one I've used and was reasonably happy with it.

查看更多
▲ chillily
4楼-- · 2019-01-13 15:26

I prefer Fake SMTP for this. It's a desktop app (packed into jar file). Since it is written in Java, you can run it both from Linux/Mac/Windows

查看更多
Explosion°爆炸
5楼-- · 2019-01-13 15:31

use the Aspirin From the docs: Aspirin is an embeddable send-only SMTP server for Java developers.

查看更多
别忘想泡老子
6楼-- · 2019-01-13 15:32

You can use smtp4dev. Please find out more details here.

查看更多
冷血范
7楼-- · 2019-01-13 15:33

For email testing, try Dumbster. From that page:

The Dumbster is a very simple fake SMTP server designed for unit and system testing applications that send email messages. It responds to all standard SMTP commands but does not deliver messages to the user. The messages are stored within the Dumbster for later extraction and verification.

The Dumbster slots itself very easily into your testing strategy. As long as your application talks to an email server using SMTP then the Dumbster can be used to test the application with no code changes.

查看更多
登录 后发表回答