[DOCKER][MAIL] Added docker mailserver setup

This commit is contained in:
Pastilhas 2020-10-15 22:14:42 +01:00 committed by Hugo Sales
parent 1747e14824
commit 250235b1be
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
5 changed files with 60 additions and 0 deletions

6
dockermail/README Normal file
View File

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

View File

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

17
dockermail/send_mail.sh Normal file
View File

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

23
dockermail/setup.sh Normal file
View File

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

6
dockermail/update.sh Normal file
View File

@ -0,0 +1,6 @@
#|/bin/bash
pushd ./mailserver || exit
docker-compose down
docker pull tvial/docker-mailserver:latest
docker-compose up -d mail