Implemtent email function