Skip to content

Instantly share code, notes, and snippets.

@sz332
Last active April 10, 2023 12:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sz332/22878c7463ee68bdfb006a55bccc967a to your computer and use it in GitHub Desktop.
Save sz332/22878c7463ee68bdfb006a55bccc967a to your computer and use it in GitHub Desktop.
Greenmail and Thunderbird
FROM openjdk:8-jre-alpine AS base
ENV GREENMAIL_OPTS -Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.smtp.hostname=localhost -Dgreenmail.verbose
RUN apk add --no-cache curl
RUN curl -O http://central.maven.org/maven2/com/icegreen/greenmail-standalone/1.5.9/greenmail-standalone-1.5.9.jar
FROM openjdk:8-jre-alpine AS final
COPY --from=base /greenmail-standalone-1.5.9.jar /greenmail-standalone-1.5.9.jar
EXPOSE 3025 3465 3143 3993 3110 3995
CMD /usr/bin/java $GREENMAIL_OPTS -jar greenmail-standalone-1.5.9.jar
Build:
docker build -t greenmail:latest .
Run:
docker run -t -i -p3025:3025 -p3110:3110 greenmail/latest
java -Dgreenmail.smtp.hostname=localhost
-Dgreenmail.hostname=0.0.0.0
-Dgreenmail.setup.test.smtp
-Dgreenmail.setup.test.pop3
-Dgreenmail.users=aniko:12345@localhost,zsolt:12345@localhost
-Dgreenmail.verbose
-jar greenmail-standalone-1.5.9.jar
Thunderbird:
Start thunderbird with profile (thunderbird -p)
Create a new profile with name aniko
aniko
aniko@localhost
12345
smtp: 3025 localhost
pop3: 3110 localhost
Write an email to zsolt@localhost
Restart thunderbird with -p argument
Create a second profile with name zsolt
zsolt
zsolt@localhost
12345
smtp: 3025 localhost
pop3: 3110 localhost
You will see a new email received
If we have a windows host, and running the docker in a virtual machine, then the port forwarding
has to be set:
Protocol | Host IP | Host port | Guest ip | Guest port
TCP | 127.0.0.1 | 3025 | | 3025
TCP | 127.0.0.1 | 3110 | | 3110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment