abstracting mail functionality