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
|
#!/bin/sh -e
#
# Figure out the system's mailname
#
syshostname=`hostname --fqdn`
if [ ! -f /etc/mailname ]; then
echo 'Please enter the "mail name" of your system. This is the hostname'
echo 'portion of the address to be shown on outgoing news and mail messages.'
echo "The default is $syshostname, your system's host name."
echo
echo -n "Mail name [$syshostname]: "
read mailname
echo
if [ "$mailname" ]; then
echo $mailname >/etc/mailname
else
echo $syshostname >/etc/mailname
fi
fi
#
# Generate configuration file if necessary
#
if [ ! -s /etc/ssmtp/ssmtp.conf ];
then
cat >>/etc/ssmtp/ssmtp.conf <<EOF
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 10
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=`cat /etc/mailname`
# The full hostname
hostname=`hostname --fqdn`
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
#FromLineOverride=YES
EOF
echo "Please check the configuration file in /etc/ssmtp/ssmtp.conf for correctness."
fi
|