Initial version

This commit is contained in:
Deon George 2023-04-25 21:32:24 +10:00
commit 853768d9bc
3 changed files with 37 additions and 0 deletions

14
Dockerfile Normal file
View File

@ -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"]

18
testmail Executable file
View File

@ -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}

5
use.sh Executable file
View File

@ -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