#!/bin/bash
# $Id: mbox_create.bash 620 2024-12-04 16:50:55Z bertrand $
# Ce script permet de créer une nouvelle boite mail sur les logiciels 
# serveur Dovecot et Postfix.
domain=$1
username=$2
password=$3
uid=$4
gid=$5
dovecot_adduser="./dovecot_adduser.bash"
postfix_adduser="./postfix_adduser.bash"
if [[ -n $domain && -n $username && -n $password && -n $uid && -n $gid && -f $dovecot_adduser && -f $postfix_adduser ]]; then
	$dovecot_adduser $domain $username $password $uid $gid
	$postfix_adduser $domain $username
else
	if [[ -z $domain || -z $username || -z $password || -z $uid || -z $gid ]]; then
		echo "usage: $0 domain username password uid gid"
	fi
	if [[ ! -f $dovecot_adduser ]]; then
		echo "$dovecot_adduser not found"
	fi
	if [[ ! -f $postfix_adduser ]]; then
		echo "$postfix_adduser not found"
	fi
fi
