Add a cron job which actually sends the emails

Extract much of the factory method body to a separate helper so
that we can also expose just the mailer bits for the cron job.

Change-Id: I19dabbafa4d4a08723e7499bc74fda9b2e7ed60f