mail exception handling added