Fixed bugs in e-mail sending