# Standard rejected warnings.
#
source $GRIMOIRE/REJECTED_MSG &&

PID=`pgrep qmail-send`
if [ -n "$PID" ]; then
  echo "qmail seems to be running, stop it first, possibly by 'telinit run smgl-qmail stop' ..."
  return 1
fi


#######################################################
### FQDN
#######################################################
FQDN=`hostname --fqdn`
config_query_string FQDN "What is your Fully Qualified Domain Name ?" "$FQDN"

#######################################################
### procmail or not
#######################################################

echo
echo  "qmail itself can handle local delivery, or can use procmail for this purpose."

config_query DELIVERY_PROCMAIL "Use procmail for local delivery ?" n

TIP_ON_USER=`grep /home/ /etc/passwd | grep -v /bin/false | head -n 1 | cut -d : -f 1`
[ -z "$TIP_ON_USER" ] && TIP_ON_USER=local_user

#######################################################
### postmaster recepient
#######################################################

echo
echo  "Please enter who will be getting mail for Postmaster."
echo  "It can be local user name, or mail address (even remote)"

config_query_string POSTMASTER_RECEPIENT "Who will recieve Postmaster's mail ?" $TIP_ON_USER

#######################################################
### MAILER-DAEMON recepient
#######################################################

echo
echo  "Please enter who will be getting mail for MAILER-DAEMON"
echo  "It can be local user name, or mail address (even remote)"

config_query_string MAILER_DAEMON_RECEPIENT "Who will recieve MAILER-DAEMON's mail ?" $POSTMASTER_RECEPIENT

#######################################################
### root recepient
#######################################################

echo
echo  "Please enter who will be getting mail for root (root does not recieve mail by himself)"
echo  "It can be local user name, or mail address (even remote)"

config_query_string ROOT_RECEPIENT "Who will recieve roots's mail ?" $MAILER_DAEMON_RECEPIENT

#######################################################
### default smtp route
#######################################################

echo
echo  "If you want, you can provide default smtp, where 'outbound' mail will be sent."
echo  "If you don't want this, just leave the line blank and press enter"
config_query_string DEFAULT_SMTP_ROUTE "Default SMTP route:"

