summaryrefslogtreecommitdiff
path: root/tests/e2e/e2e-test.sh
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-12-22 15:42:14 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-12-26 14:55:41 +0100
commitb225824648af4bb69356ed70969eb59fa203d5e6 (patch)
treead497b6bf98ded1b3da92074eb759d54f24504a4 /tests/e2e/e2e-test.sh
parentf98af5593c41ce7dd826b491b3aa3953922d60f9 (diff)
[test] send mail with custom header to tmp_user
Diffstat (limited to 'tests/e2e/e2e-test.sh')
-rwxr-xr-xtests/e2e/e2e-test.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/e2e/e2e-test.sh b/tests/e2e/e2e-test.sh
index 39eb2009..3e6d2bb5 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
+
+