adding error detection from php
got synchranous mail working