Friday, April 1, 2016

Scripting for Postfix Mail Server configuration

echo "    *************** First RPM check ***********"
if rpm -qa|grep postfix
 then
 {
  echo "Write down your domain name"
  read "l"
  echo "write down your hostname"
  read "h"
  echo "write down your network like 192.168.1.0/24"
  read "n"
  echo ""
  echo '
  inet_interfaces = all
  myhostname = '$h'
  myorigin = '$l'
  mydomain = '$l'
  mydestination = $myhostname, $mydomain, $myorigin
  relayhost = [smtp.'$l']
  mynetworks = '$n' 127.0.0.0/8
  ' > /etc/postfix/main.cf


  #************************
  echo "which one u use ?"
  echo "  1: Squirrel"
  echo "  2: Open Webmail"
  echo "  3: Other"
  read a
  if [ $a -eq 1 ]
    then 
    {
     echo "home_mailbox = Mailbox" >>/etc/postfix/main.cf
    }
  elif [ $a -eq 2 ]
    then
    {
     echo "#home_mailbox = !default" >>/etc/postfix/main.cf
    }
  else
    {
     echo "home_mailbox = Maildir">>/etc/postfix/main.cf
    }
  fi
  echo ""
  clear
  echo ""
  echo ""
  service postfix restart
  echo ""
  echo "************************************************************"
  echo "*    Postfix configuration has been completed              *"
  echo "*                   Enjoy It                               *"
  echo "************************************************************"
 }
else 
 {
 clear
 echo ""
 echo ""
 echo "  *************************************************************"
 echo "  *          No rpm installed for postfix                     *"
 echo "  *          Please install the rpm first                     *"
 echo "  *************************************************************"
 }
fi
echo "******  Do u want to configure dovecot ?  **********************"
echo "  1 > press 1 for yes"
echo "  2 > press 2 for no "
echo ""
read a
if [ $a -eq 1 ]
 then
  {
   ./dovecot.sh
  }
else 
 echo "***** Ok Dovecot is not configured *******"
fi
 

No comments:

Post a Comment