functionize email sending to prevent cron delays