跳到主内容

Test email with MailHog

This guide explains how to send the emails of Casdoor to MailHog, an SMTP server for testing that catches all messages and shows them in a web UI.


Learning outcomes​

  • Point an email provider at MailHog.
  • Send a test email and read it in MailHog.

What you need​

  • MailHog running where Casdoor can reach it
  • Administrator access to the Casdoor admin console

运行 MailHog​

Start MailHog, so that its SMTP server is reachable from Casdoor. This guide uses the host 192.168.24.128 and the port 1025.

MailHog配置

Add the provider in Casdoor​

  1. In the Casdoor admin console, go to Identity > Providers and add a provider.

  2. Set Category to Email and Type to Default.

  3. Set Host and Port to the address of MailHog. MailHog needs no authentication by default.

    MailHog settings in Casdoor

  4. Save the provider.

Verify the result​

  1. Click Test SMTP Connection. Casdoor reports SMTP connected successfully.

  2. Click Send Testing Email. Casdoor reports Email sent successfully.

    Test email sent from Casdoor

  3. Open the web UI of MailHog. The message is there.

    Test email in MailHog

See also​