From 44f6407de83f19a0453a3a6a9ef1a20b26664285 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Mon, 22 Feb 2016 12:17:59 -0800 Subject: [PATCH] Swaks updates --- swaks-tests/README.md | 30 ++++++++++++++++++++++++++++++ swaks-tests/run-tests.sh | 19 +++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 swaks-tests/README.md diff --git a/swaks-tests/README.md b/swaks-tests/README.md new file mode 100644 index 0000000..c8b7102 --- /dev/null +++ b/swaks-tests/README.md @@ -0,0 +1,30 @@ +swaks-tests +=========== + +[Swaks](http://www.jetmore.org/john/code/swaks/) - Swiss Army Knife for SMTP + +Swaks gives us an easy way to generate mail to send into Inbucket. You will need to +install Swaks before you can use the provided scripts. + +## Usage + +To deliver a batch of test email to the `swaks` mailbox, assuming Inbucket SMTP is listening +on localhost:2500: + + ./run-tests.sh + +To deliver a batch of test email to the `james` mailbox: + + ./run-tests.sh james + +You may also pass swaks options to deliver to a alternate host/port: + + ./run-tests --server inbucket.mydomain.com:25 + +To specify the mailbox with an alternate server, use `--to` with a local and host part: + + ./run-tests --server inbucket.mydomain.com:25 --to james@mydomain.com + +## To Do + +Replace Swaks with a native Go solution. diff --git a/swaks-tests/run-tests.sh b/swaks-tests/run-tests.sh index e5300c2..9f4b9e1 100755 --- a/swaks-tests/run-tests.sh +++ b/swaks-tests/run-tests.sh @@ -1,8 +1,23 @@ #!/bin/sh -# run-tests.sh: Generate test emails for Inbucket +# run-tests.sh +# description: Generate test emails for Inbucket + +set -eo pipefail + +case "$1" in + "") + to="swaks" + ;; + --*) + to="swaks" + ;; + *) + to="$1" + ;; +esac export SWAKS_OPT_server="127.0.0.1:2500" -export SWAKS_OPT_to="swaks@inbucket.local" +export SWAKS_OPT_to="$to@inbucket.local" # Basic test swaks $* --h-Subject: "Swaks Plain Text" --body text.txt