feat: Added Dovecot and Postfix to container

Initial config also added.

MR !1
This commit is contained in:
2022-02-14 09:40:47 +09:30
parent ec9e329956
commit df8997f07d
38 changed files with 1555 additions and 0 deletions

14
include/bin/postfix.sh Normal file
View File

@ -0,0 +1,14 @@
#! /bin/bash
trap "service postfix stop" SIGINT
trap "service postfix stop" SIGTERM
trap "service postfix reload" SIGHUP
service postfix start
# wait until postfix is dead (triggered by trap)
while kill -0 "$(< /var/spool/postfix/pid/master.pid)"
do
sleep 5
done

View File

@ -0,0 +1,20 @@
#!/bin/sh
PERCENT=$1
USER=$2
cat << EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o "plugin/quota=maildir:User quota:noenforcing"
Auto-Submitted: auto-generated
Date: $(date +'%a, %-d %b %Y %H:%M:%S %z')
From: Postmaster <NO-REPLY@$(hostname -f)>
Subject: Mailbox Quota Warning
Hi,
Just wanted to let you know that Your mailbox is now $PERCENT% full.
Note: This is an automated message. Please do not respond to it.
TIP:
EOF

View File

@ -0,0 +1,36 @@
#!/bin/sh
set -e
USER=$1
cat << EOF | /usr/lib/dovecot/dovecot-lda -d ${USER} -o "plugin/quota=maildir:User quota:noenforcing"
Auto-Submitted: auto-generated
Date: $(date +'%a, %-d %b %Y %H:%M:%S %z')
From: Postmaster <NO-REPLY@$(hostname -f)>
Subject: New User Welcome
Hi,
This E-Mail has been sent to inform you of some of the ins and outs of this E-Mail server.
Features available to you:
- IMAP Sieve
- Spam automatically sent to your spam folder
- Ability to share your E-mail folders with other users
Quota
=====
Your mailbox has a set quota that should be visible in your E-Mail client. A quota is the storage space that your E-Mails use. It is your responsability to keep you storage below your allocated quota, or you won't be able to send or receive E-Mails.
Spam
====
Spam is defined as unwanted messages, which sometimes contains malicious software. It's advised if you receive a message you think is spam, don't open it. Move it to your spam folder. Any spam that we detect, will automatically delivered to your spam folder. If we miss a spam messages, as stated earlier, please move it to your spam folder.
We have a learning bot that automagically uses your spam folder to learn why it is spam. After our AI learns, it will be better next time at catching the spam messages so you don't have to.
$(if [ "0$POST_MASTER_EMAIL" != "0" ]; then echo "If you have any concerns, please email the postmaster ($POST_MASTER_EMAIL)."; fi )
EOF