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

Help wanted - Spring-Boot Configuration #44

Closed Reagan1947 closed 2 years ago

Reagan1947 commented 2 years ago

How should I configure

Describe :

I want to test my sending Email function, in my Spring-Boot project, I have the following configuration:

mail:
  protocol: smtp
  host: ****
  port: ****
  username: ***
  password: **
  test-connection: true
  default-encoding: utf-8

And I wan to use fake-smtp-server to test my function, should I change the Spring-Boot config ? I Changed the host to localhost and port to 5025 and I do received Email in fake-smtp-serve. I'm wondering if I just need to change the port configuration

Ref :

The test configuration I used:

mail:
  protocol: smtp
  host: localhost
  port: 5025
  username: ***
  password: ***
  test-connection: true
  default-encoding: utf-8
gessnerfl commented 2 years ago

@Reagan1947 basically this should work. You only need to adopt in the test the configuration to the host and port of the fakesmtp server instance which you use for testing. If the service is running locally or in a container using port bindings localhost should work well.

Reagan1947 commented 2 years ago

@Reagan1947 basically this should work. You only need to adopt in the test the configuration to the host and port of the fakesmtp server instance which you use for testing. If the service is running locally or in a container using port bindings localhost should work well.


Thank you very much, I would like to know more about the following configuration, does it apply to bind my SMTP Server host at Spring-Boot config?:

#The binding address of the Fake SMTP Server; Bound to all interfaces by default / no value
fakesmtp.bindAddress
gessnerfl commented 2 years ago

With fakesmtp.bindAddress you can configure to which network interface the smtp server port should be bound. By default it will be bound to all interfaces/addresses. The configuration needs to be specified compatible to java.net.InetAddress.

Reagan1947 commented 2 years ago

With fakesmtp.bindAddress you can configure to which network interface the smtp server port should be bound. By default it will be bound to all interfaces/addresses. The configuration needs to be specified compatible to java.net.InetAddress.


Thank you so match !