-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinstall-postfix.sh
More file actions
executable file
·50 lines (32 loc) · 1.02 KB
/
install-postfix.sh
File metadata and controls
executable file
·50 lines (32 loc) · 1.02 KB
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
47
48
49
50
#!/bin/bash
###
echo -n "Domain name to use in outbound mail (e.g. example.org): "
read HOSTNAME
if [ -z "$HOSTNAME" ]
then
echo "Domain must not be empty"
exit
fi
###
echo -n "Email address to forward local mail sent to root/postmaster to (e.g. john@gmail.com): "
read EMAIL
###
export DEBIAN_FRONTEND=noninteractive
apt-get -y install mailutils
###
sed -e "s/#\?myhostname .*/myhostname = $HOSTNAME/g" -i /etc/postfix/main.cf
sed -e "s/#\?mydestination .*/mydestination = $HOSTNAME, localhost.localdomain, localhost/g" -i /etc/postfix/main.cf
sed -e "s/#\?inet_interfaces .*/inet_interfaces = localhost/g" -i /etc/postfix/main.cf
###
echo "$HOSTNAME" > /etc/mailname
if [ -n "$EMAIL" ]
then
echo "root: $EMAIL" >> /etc/aliases
newaliases
fi
###
service postfix restart
echo ""
echo "Create a SPF DNS record, see \"http://www.openspf.org/SPF_Record_Syntax\" for details"
echo "Create a PTR reverse DNS record, see \"http://help.dnsmadeeasy.com/managed-dns/dns-record-types/ptr-record/\" for details"
echo ""