From 01ea89e7e2e814514fb75c81554c3a333f72cc39 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sun, 18 Sep 2016 13:03:10 -0700 Subject: [PATCH] Multi-recipient swaks test - Add a multi-recipient test to run-tests.sh - Removal accidental output of jq binary location when pretty-printing REST JSON - Add To: change to CHANGELOG.md - Fix comment typo --- CHANGELOG.md | 3 +++ etc/rest-apiv1.sh | 2 +- smtpd/filestore.go | 4 +--- swaks-tests/run-tests.sh | 9 ++++++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce2e03..b1c157c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). [Unreleased] ------------ +### Added +- Storage of To: header in messages (likely breaks existing datastores) + ### Fixed - We should no longer run out of file handles when dealing with a large number of recipients on a single message. diff --git a/etc/rest-apiv1.sh b/etc/rest-apiv1.sh index 0a30433..880bb99 100755 --- a/etc/rest-apiv1.sh +++ b/etc/rest-apiv1.sh @@ -103,7 +103,7 @@ main() { esac # Use jq to pretty-print if installed and we are expecting JSON output - if [ $pretty ] && [ $is_json ] && type -P jq; then + if [ $pretty ] && [ $is_json ] && type -P jq >/dev/null; then curl -s $curl_opts -H "Accept: application/json" --noproxy "$API_HOST" -X "$method" "$url" | jq . else curl -s $curl_opts -H "Accept: application/json" --noproxy "$API_HOST" -X "$method" "$url" diff --git a/smtpd/filestore.go b/smtpd/filestore.go index a17c5e1..81e3385 100644 --- a/smtpd/filestore.go +++ b/smtpd/filestore.go @@ -344,13 +344,11 @@ func (m *FileMessage) From() string { return m.Ffrom } - -// From returns the value of the Message From header +// From returns the value of the Message To header func (m *FileMessage) To() string { return m.Fto } - // Subject returns the value of the Message Subject header func (m *FileMessage) Subject() string { return m.Fsubject diff --git a/swaks-tests/run-tests.sh b/swaks-tests/run-tests.sh index 62e6bd3..e747dde 100755 --- a/swaks-tests/run-tests.sh +++ b/swaks-tests/run-tests.sh @@ -3,6 +3,7 @@ # description: Generate test emails for Inbucket set -eo pipefail +[ $TRACE ] && set -x # We need to be in swaks-tests directory cmdpath="$(dirname "$0")" @@ -19,6 +20,7 @@ case "$1" in ;; *) to="$1" + shift ;; esac @@ -28,6 +30,10 @@ export SWAKS_OPT_to="$to@inbucket.local" # Basic test swaks $* --h-Subject: "Swaks Plain Text" --body text.txt +# Multi-recipient test +swaks $* --to="$to@inbucket.local,alternate@inbucket.local" --h-Subject: "Swaks Multi-Recipient" \ + --body text.txt + # HTML test swaks $* --h-Subject: "Swaks HTML" --data mime-html.raw @@ -35,7 +41,8 @@ swaks $* --h-Subject: "Swaks HTML" --data mime-html.raw swaks $* --h-Subject: "Swaks Top Level HTML" --data nonmime-html.raw # Attachment test -swaks $* --h-Subject: "Swaks Attachment" --attach-type image/png --attach favicon.png --body text.txt +swaks $* --h-Subject: "Swaks Attachment" --attach-type image/png --attach favicon.png \ + --body text.txt # Encoded subject line test swaks $* --data utf8-subject.raw