forked from cryptopool-builders/multipool_yiimp_single
-
Notifications
You must be signed in to change notification settings - Fork 0
/
send_mail.sh
46 lines (35 loc) · 1.54 KB
/
send_mail.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
#####################################################
# Created by cryptopool.builders for crypto use...
#####################################################
source /etc/functions.sh
source /etc/multipool.conf
source $STORAGE_ROOT/yiimp/.yiimp.conf
set -eu -o pipefail
function print_error {
read line file <<<$(caller)
echo "An error occurred in line $line of file $file:" >&2
sed "${line}q;d" "$file" >&2
}
trap print_error ERR
if [[ ("$wireguard" == "true") ]]; then
source $STORAGE_ROOT/yiimp/.wireguard.conf
fi
echo -e " Installing mail system $COL_RESET"
sudo debconf-set-selections <<< "postfix postfix/mailname string ${PRIMARY_HOSTNAME}"
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
apt_install mailutils
sudo sed -i 's/inet_interfaces = all/inet_interfaces = loopback-only/g' /etc/postfix/main.cf
sudo sed -i 's/myhostname =/# myhostname =/g' /etc/postfix/main.cf
sudo sed -i 's/mydestination/# mydestination/g' /etc/postfix/main.cf
sudo sed -i '/# mydestination/i mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain' /etc/postfix/main.cf
sudo sed -i '/# myhostname =/i myhostname = localhost' /etc/postfix/main.cf
sudo systemctl restart postfix
whoami=`whoami`
sudo sed -i '/postmaster: root/a root: '${SupportEmail}'' /etc/aliases
sudo sed -i '/root:/a '$whoami': '${SupportEmail}'' /etc/aliases
sudo newaliases
sudo adduser $whoami mail
echo -e "$GREEN Mail system complete...$COL_RESET"
set +eu +o pipefail
cd $HOME/multipool/yiimp_single