commit 853768d9bc09c0940eb357f18c8eb88439817a57 Author: Deon George Date: Tue Apr 25 21:32:24 2023 +1000 Initial version diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..557605e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# NAME leenooks/smtptest +# VERSION latest + +FROM alpine + +# Change to http respositories, so they we can cache the install packages +RUN if [ -n ${HTTP_PROXY} ] ; then sed -ie s'/https/http/' /etc/apk/repositories; fi + +RUN apk add --no-cache ssmtp +RUN sed -i -e 's/^mailhub=mail$/mailhub=smtp/' -e "s/^hostname=/#hostname=/" -e 's/#FromLineOverride=YES/FromLineOverride=YES/' /etc/ssmtp/ssmtp.conf + +COPY testmail /usr/local/bin/ + +ENTRYPOINT ["testmail"] diff --git a/testmail b/testmail new file mode 100755 index 0000000..e5ee6b1 --- /dev/null +++ b/testmail @@ -0,0 +1,18 @@ +#!/bin/sh + +[ -z "$1" ] && echo "testmail [user@email]" && exit 1 + +SENDTO=deon@dege.au +FROMUSER=$1 +TMPFILE=/tmp/testmail.$$ + +echo "To: check-auth-${SENDTO/@/=}@verifier.port25.com" > ${TMPFILE} +echo "Cc: ${SENDTO}" >> ${TMPFILE} +echo "From: $1" >> ${TMPFILE} +echo "Date: `date --rfc-2822`" >> ${TMPFILE} + +echo "Subject: Test Message" >> ${TMPFILE} +echo "This is a test message" >> ${TMPFILE} +echo "--- done" >> ${TMPFILE} + +cat ${TMPFILE} | ssmtp -t -f ${FROMUSER} diff --git a/use.sh b/use.sh new file mode 100755 index 0000000..70b94fd --- /dev/null +++ b/use.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +FROMHOST=c-8-1.leenooks.lan + +docker run -it --add-host smtp:172.17.0.1 --hostname=${FROMHOST} leenooks/smtptest deon@dege.au