From 9ea86c0aff440d74b1e0bc1fde99b037b921ffcb Mon Sep 17 00:00:00 2001 From: pierreozoux Date: Fri, 9 Oct 2015 19:50:19 +0100 Subject: [PATCH] adds a mailbox script --- utils/add_mailbox.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 utils/add_mailbox.sh diff --git a/utils/add_mailbox.sh b/utils/add_mailbox.sh new file mode 100755 index 0000000..649a425 --- /dev/null +++ b/utils/add_mailbox.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e +set -u +set -x + +source /etc/environment + +email=$1 +email_password=$2 + +local_part=`echo $email | cut -d@ -f1` +email_domain=`echo $email | cut -d@ -f2` + +curl --data "username=${mail_username}&password=${mail_password}&login=Log+In&rememberme=0" -c /tmp/cookie.txt https://${mail_hostname}/auth/login +domain_id=`curl -b /tmp/cookie.txt https://${mail_hostname}/domain | grep $email_domain | grep purge-domain | grep -o 'purge-domain-[0-9]*' | grep -o '[0-9]*'` +curl --data "local_part=${local_part}&domain=${domain_id}&password=${email_password}" -b /tmp/cookie.txt https://${mail_hostname}/mailbox/add + +rm /tmp/cookie.txt