docker build -t infointent/email-sender:v1.0 . docker run -d -p 8081:8081 --name email-sender -t infointent/email-sender:v1.0 docker ps docker exec -ti email-sender sh docker stop docker rm docker rmi infointent/email-sender:v1.0 docker rmi $(docker images --filter "dangling=true" -q --no-trunc) docker image prune
- Open http://localhost:8081/file and upload file
- Email client info is configured in application.properties file
- Trigger POST http://127.0.0.1:8081/mail/send
{
"subject": "[Do not reply]Sample email without attachment",
"body": "Hi, This is sample mail without attachment",
"to": ["example@example.com"],
"cc": [],
"bcc": [],
"attachments": []
}
- Email sender service will
- validate the request and attachments.
- compose the email with detail sent in request.
- attach the file in mail.
- Generate Gmail app password
- Login to google account security
- Enable Two-factor authentication.
- Now, Go to App password > select Other > Give any name and click generate.
- Copy the generated password and paste in application.properties as value of spring.mail.password