E-mail notification X days before subscription expires?

Hi,

Is there a way to custom an e-mail notification that would be sent to members in order to remind them about payement, somedays before membership expires? Or disable the front end but X days after expiry of a level membership ?
It would be better than disable immediately the front end.

Thanks.