From b225824648af4bb69356ed70969eb59fa203d5e6 Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 22 Dec 2016 15:42:14 +0100 Subject: [test] send mail with custom header to tmp_user --- tests/e2e/e2e-test.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/e2e/e2e-test.sh b/tests/e2e/e2e-test.sh index 39eb200..3e6d2bb 100755 --- a/tests/e2e/e2e-test.sh +++ b/tests/e2e/e2e-test.sh @@ -1,14 +1,27 @@ #!/bin/bash +# Usage +# +# In order to send authenticated mail to the tmp_user you need to +# export these environment variables before running this script: +# - FROM_EXTERNAL_OPTS for sending mails from external mailservers to the tmp_user account +# +# as an example: +# export FROM_EXTERNAL_OPTS='-f user@example.org --tlsc --au user@example.or -ap MYPASSWORD -s smtp.example.org' + + set -x set -e PROVIDER='cdev.bitmask.net' BCTL='bitmaskctl' LEAP_HOME='~/.config/leap' +MAIL_UUID=$(uuidgen) + username="tmp_user_$(date +%Y%m%d%H%M%S)" user="${username}@${PROVIDER}" pw="$(head -c 10 < /dev/urandom | base64)" +SWAKS="swaks -t $user --header-X-MAIL-UUID \"$MAIL_UUID\"" # Stop any previously started bitmaskd # and start a new instance @@ -36,7 +49,12 @@ imap_pw="None" while [[ $imap_pw == *"None"* ]]; do response=$("$BCTL" mail get_token) sleep 2 - imap_pw=$(echo $response | head -n 1 | sed 's/ */ /g' | cut -d' ' -f 2) + imap_pw=$(echo "$response" | head -n 1 | sed 's/ */ /g' | cut -d' ' -f 2) done -echo "IMAP/SMTP PASSWD: $imap_pw" +#echo "IMAP/SMTP PASSWD: $imap_pw" + + +$SWAKS $FROM_EXTERNAL_OPTS + + -- cgit v1.2.3