diff --git a/dockermail/README b/dockermail/README new file mode 100644 index 0000000000..7851d197d8 --- /dev/null +++ b/dockermail/README @@ -0,0 +1,6 @@ +To start, run setup.sh choose name and domain and create the first email account. Then open mailserver/ and run 'docker-compose up' +To change settings read mailserver/env-mailserver + +To update, run update.sh + +Add more accounts with add_account.sh and send mails with send_mail.sh diff --git a/dockermail/add_account.sh b/dockermail/add_account.sh new file mode 100644 index 0000000000..a5279c6773 --- /dev/null +++ b/dockermail/add_account.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +read -p "EMAIL: " user +read -s -p "PASS: " password +printf "\n" + +bash mailserver/setup.sh email add "$user" "$password" + diff --git a/dockermail/send_mail.sh b/dockermail/send_mail.sh new file mode 100644 index 0000000000..823901a3e3 --- /dev/null +++ b/dockermail/send_mail.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if ! command -v swaks &> /dev/null +then + echo "SWAKS not found." + exit +fi + +read -p "TO: " to_input +read -p "FROM: " from_input +read -s -p "PASS: " pass_input +printf "\n" +read -p "SERVER: " host_input +read -p "HEADER: " header_input +read -p "BODY: " body_input + +swaks -t "$to_input" -f "$from_input" -s "$host_input" -au "$from_input" -ap "$pass_input" --header "$header_input" --body "$body_input" -tlso diff --git a/dockermail/setup.sh b/dockermail/setup.sh new file mode 100644 index 0000000000..709e471bd1 --- /dev/null +++ b/dockermail/setup.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +mkdir ./mailserver +pushd ./mailserver || exit +curl -o setup.sh https://raw.githubusercontent.com/tomav/docker-mailserver/master/setup.sh && chmod a+x ./setup.sh +curl -o docker-compose.yml https://raw.githubusercontent.com/tomav/docker-mailserver/master/docker-compose.yml.dist +curl -o env-mailserver https://raw.githubusercontent.com/tomav/docker-mailserver/master/env-mailserver.dist + +if [ -f .env ]; then + rm ./.env +fi + +echo "CONTAINER_NAME=mail" >> .env +read -r -p "HOSTNAME: " +echo "HOSTNAME=$REPLY" >> .env +read -r -p "DOMAIN: " +echo "DOMAINNAME=$REPLY" >> .env + +printf "\nSetup the first account.\n" +read -r -p "Enter Email: " user + +bash ./setup.sh email add "$user" +bash ./setup.sh config dkim diff --git a/dockermail/update.sh b/dockermail/update.sh new file mode 100644 index 0000000000..01b527ced9 --- /dev/null +++ b/dockermail/update.sh @@ -0,0 +1,6 @@ +#|/bin/bash + +pushd ./mailserver || exit +docker-compose down +docker pull tvial/docker-mailserver:latest +docker-compose up -d mail