docker-postfix/test.sh
Bojan Čekrlić 928e5d64c7 Initial support for DKIM and testing
This commit brings two important features:
- **DKIM support** It's now possible to configure this postfix
  image to sign messages using DKIM by simply generating the keys
  and providing them in the approprate folder. This should bring
  us one step closer to directly sending out emails without relying
  on a 3rd-party proxy.
- **test support** A nice and handy script, conviniently called
  `test.sh` has been provided, builds the image, spins it up and
  tries to send out an email. You'll need `docker-compose` to run
  it, though.
2019-02-19 10:49:55 +01:00

32 lines
582 B
Bash
Executable file

#!/bin/sh
docker build . -t boky/postfix
docker-compose up -d
# Wait for postfix to startup
echo "Waiting for startup..."
while ! docker ps | fgrep postfix_test_587 | grep -q healthy; do
sleep 1
done
cat <<"EOF" | nc -C localhost 1587
HELO test
MAIL FROM:test@example.org
RCPT TO:check-auth@verifier.port25.com
DATA
Subject: Postfix message test
From: test@example.org
To: check-auth@verifier.port25.com
Content-Type: text/plain
This is a simple text
.
QUIT
EOF
# Wait for email to be delivered
echo "Waiting to shutdown..."
sleep 5
# Shut down tests
docker-compose down