mail implementation