Return output directly, without intermediate var
User filter_by() where possible.
Rework logging for completion mails
Get header From address from configuration
Simplify getting list of email recipients