Mailgun email configuration to a jhipster project

Jhipster project requires email configuration so that application can send email during events like new user registration and forgot password.

I will be configuring mailgun email since its free plan support upto 400 mails per day.

Steps:

  1. Edit file src/main/resources/config/application-dev.yml and src/main/resources/config/application-prod.yml
spring:
mail:
host: smtp.mailgun.org
port: 25
username: <user id>
password: <password>

Note: Use complete mail id in the above configuration. It will be like <username>.mailgun.org

2. Choose your preferred sender id for the emails sent by the application.
Edit file src/main/resources/config/application.yml

If you want all your mails be send by the id support@myapp, then configuration will be as follows

jhipster:
mail:
from: support@myapp

3. Modify baseurl value in the file src/main/resources/config/application-prod.yml

Say if you have hosted your application on heroku platform under free hosting plan, your application url will be something like
https://myapp.herokuapp.com

jhipster:
mail:
base-url: https://myapp.herokuapp.com

This steps is necessary because activation link sent after new user registration will be in format Similarly, after forget password event, the pasword reset link will also comprises of base-url. These links will be a valid url only if you have specified true baseurl.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store