This tutorial will walk you through the steps of Sending Email With Amazon SES SMTP Server and Java Mail API.
What you'll need
- JDK 1.7+
- Maven 3+
- Amazon SES account
- SMTP Credentials of your Amazon SES account
- Verified From email and To email on SES console
Stack
- Java Mail API
- AWS SES
Init project structure and dependencies
Project structure
├── src
│ └── main
│ └── java
│ └── com
│ └── hellokoding
│ └── mail
│ ├── Main.java
│ └── SendingMailThroughAWSSESSMTPServer.java
└── pom.xml
Project dependencies
Sending Mail with Java Mail API and AWS SES SMTP Server
Run
Replace below macros with your respective values and run the command
mvn clean package exec:java -Dexec.args="{SMTP_USER_NAME} {SMTP_USER_PASSWORD} {FROM_USER_EMAIL} {FROM_USER_FULLNAME} {TO_USER_EMAIL}"
Source code
https://github.com/hellokoding/hellokoding-courses/tree/master/java-examples/javamail-awsses