was giving error msg even if mail sent successfully. fixed