adds a mailbox script

This commit is contained in:
pierreozoux 2015-10-09 19:50:19 +01:00
parent df083275d3
commit 9ea86c0aff

18
utils/add_mailbox.sh Executable file
View file

@ -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