#!/bin/bash

if [ $# -lt 3 ]; then
	echo "Syntax: $0 <from> <mail_size> <to> (--prod)" >&2
        echo "Pipe to STDIN the mail content." >&2
	exit 1
fi

if [[ "$@" = *" --prod"* ]]; then
    tdb_env="--env=prod"
else
    tdb_env="--env=dev"
fi

php app/console TVn7:mailhandler:handle $tdb_env $1 $2 $3 <&0