#!/bin/bash
#
#	Process mail queues for this site
#	
#########################################################################
#
# Version control (Follows format used in PHP programs to track versions
# $module_version[ 'Admin/ProcessMailQueue.sh' ] = "02.01.02";
#
#	02.01.01	Version 2.01 created under Productivity Framework Version 2
#	02.01.02	Allow command line override to "Report" 
#
###########################################################################
# Determine what to do. Default is to 'Send' all pending messages
action=$1
if [[ -z "$1" ]] ; then action="Send" ; fi

# Assume this is run from the /Admin folder; change there to insure the correct PF_Config settings are loaded
dirName=`dirname $0`
cd ${dirName}

# Allow tracking of our last execution
touch ../files/logs/LastMailProcess.txt

# Disable Cronttab mail output
MAILTO=""

# Assume this is run from the /Admin folder; change there to insure the correct PF_Config settings are loaded
echo /usr/bin/php -f ${dirName}/ProcessMailQueue.php -- --action=$action
/usr/bin/php -f ${dirName}/ProcessMailQueue.php -- --action=$action


