gessnerfl / fake-smtp-server

A simple SMTP Server for Testing purposes. Emails are stored in an in-memory database and rendered in a Web UI
Apache License 2.0
426 stars 88 forks source link

[feature-request] consider proxy mode #29

Closed bilak closed 4 years ago

bilak commented 4 years ago

Hi, at first thanks for this application, it helped me during development. Would you consider functionality, where it will be possible to store mails inside fake-smtp-server as it's possible to store now and also send messages via configured smtp server? So basically fake-smtp-server will serve as some kind of proxy where it would be possible:

thanks

gessnerfl commented 4 years ago

@bilak basically I think this would be possible to implement without too much effort as Spring Boot is already providing good support for sending emails. The configuration could be reused from Spring Boot and proxing could be just added as an additional configuration option.

However it would be good if you could explain in more detail what is the background of this feature request?

bilak commented 4 years ago

Background is for example: when I have some templating system and tester/developer is testing/developing some template, the system is connected to live group emails. But sometimes it needs to be changed little bit, so to ease development I can stop sending those changed emails for a while and if template is fixed/changed I can again send emails to the group.

gessnerfl commented 4 years ago

@bilak the feature is now available with version 1.5.0. Looking forward to get feedback from your side!

To proxy/forward messages you just have to activate the forwarding mode by adding the following setting to the application.properties file:

fakesmtp.forwardEmails=false

In addition to this a mail server needs to be configured using Spring Boot settings. Therefore please check the official Spring Boot documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-email