added email sending, encode undone yet