refactored senddigestmails