File: generate_config

package info (click to toggle)
ssmtp 2.64-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 732 kB
  • ctags: 388
  • sloc: ansic: 2,048; sh: 495; makefile: 126
file content (72 lines) | stat: -rwxr-xr-x 1,451 bytes parent folder | download | duplicates (5)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash -e

#
# Figure out the system's mailname
#

if test `uname` == 'SunOS'
then
	syshostname=`uname -n`
else
	syshostname=`hostname --fqdn`
fi

if test -f /etc/mailname
then
	mailname="`head -1 /etc/mailname`"
fi

if test -z "$mailname"
then
	mailname=$syshostname
fi

echo "Please enter the mail name of your system."
echo "This is the hostname portion of the address to be shown"
echo "on outgoing news and mail messages headers."
echo "The default is $syshostname, your system's host name."
echo
echo -n "Mail name [$syshostname]: "
read mailname
echo

echo -n "Please enter the SMTP port number [25]: "
read smtpport
if test -z "$smtpport"
then
	mailhub=$mailhub
else
	mailhub="$mailhub:$smtpport"
fi

#
# Generate configuration file
#
if test -s "$1"
then
	echo Configuration file $1 already exists.
	exit 0
fi

cat >>$1 <<EOF
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and you mailhub is so named.
mailhub=mail
# Where will the mail seem to come from?
#rewriteDomain=`echo -n $mailname`
# The full hostname
hostname=`hostname --fqdn`
EOF

echo
echo
echo "Please check the configuration file $1 for correctness."
echo
echo