Skip to content

concosminx/mail-with-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mail-with-java

Java mail usage for different providers | scenarios with Jakarta

  1. Testing local with MailHog | Fake SMTP Server

Prerequisites:

  • use docker for MailHog see - docs
docker run -p 8025:8025 -p 1025:1025 -d mailhog/mailhog

or docker compose

services: mailhog: image: mailhog/mailhog logging: driver: 'none' # disable saving logs ports: - 1025:1025 # smtp server - 8025:8025 # web ui
  1. Testing with Gmail SMTP Server (no Oauth2, just user and app password)

You will need an app password from your Google Account (can be generated only if 2FA is active). see docs TLS or SSL can be used see docs

Extra guides here

  1. Testing with Microsoft 365

For this you need to configure some stuff. Follow the official guide and configure the app in MS365 for client credential flow. Don't forget to do this. Turn on IMAP / POP3 if needed (Gmail / Settings / Forwarding and POP/IMAP)

You will need an access token from the token endpoint for your app based on:

  • a client secret
  • the client id (the app id)
  • the scope https://outlook.office365.com/.default
  • grant_type: client_credentials

Use the token as a password in code.

About

Java mail usage for different providers | scenarios

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages