[WIP] Adding an in-memory queue for automatic retry for email

- fixes #547