put mail stuff to function