Do not connection when no emails to send

Little optimisation of sending alerts to users.
Do not connection when no emails to send.