fixed bug in sending mail from a pre-handler