SMTP Server Setup for Development
SMTP Server Setup for Development
Section titled “SMTP Server Setup for Development”Overview
Section titled “Overview”Hatchgrid supports multiple SMTP server options for development and testing. This document provides guidance on setting up and configuring SMTP servers for your development environment.
Available SMTP Servers
Section titled “Available SMTP Servers”1. GreenMail (Default)
Section titled “1. GreenMail (Default)”GreenMail is a test suite for email servers that provides a comprehensive set of email protocols and a web interface.
- SMTP Port: 3025
- Web Interface: http://localhost:8080
- Configuration: See Email Testing with GreenMail
2. MailDev
Section titled “2. MailDev”MailDev is a simple SMTP server with a clean web interface for viewing and testing emails.
- SMTP Port: 1025
- Web Interface: http://localhost:1080
- Configuration: See MailDev Setup
Switching Between SMTP Servers
Section titled “Switching Between SMTP Servers”Use the provided script to switch between SMTP servers:
./scripts/switch-mail-server.sh [greenmail|maildev]
Spring Boot Configuration
Section titled “Spring Boot Configuration”Update your Spring Boot application configuration to use the appropriate SMTP server:
# For GreenMailspring: mail: host: localhost port: 3025 protocol: smtp properties: mail: smtp: auth: false starttls: enable: false
# For MailDevspring: mail: host: localhost port: 1025 protocol: smtp properties: mail: smtp: auth: false starttls: enable: false
Keycloak Configuration
Section titled “Keycloak Configuration”To configure Keycloak to use your SMTP server:
- Log in to the Keycloak Admin Console
- Select your realm
- Go to Realm Settings > Email
- Update the SMTP settings:
- Host: localhost
- Port: 3025 (GreenMail) or 1025 (MailDev)
- From: noreply@hatchgrid.local
- Enable Authentication: No
- Enable SSL: No
- Enable StartTLS: No
Testing Email Functionality
Section titled “Testing Email Functionality”To test email functionality:
- Start your chosen SMTP server
- Configure your application to use the correct SMTP port
- Trigger an email-sending action (e.g., user registration)
- Check the web interface of your SMTP server to view the sent email