Updated to enable checkpointing
Updated SendEmail class to be more flexible