Add support to configure notifications expiration.

You can define the period while a delivered notification
remains valid. After that, notification becomes expired
and new emails could be sent.
Group notifications by set_state.