How to use Rules to send an email to customers 1 month prior to license expiration date? I am using the Drupal Commerce module and I have a product type service for license to be sold on site. I have different licences (products) like 1 year license, 2 year license, 6 months license and many more.

I need to send an email to customers 1 month prior to their license expiration date. Like if customer purchased a license for 1 year, then the email should be sent 11 months after date of purchase. Similarly with other products like after 5 months if license is for 6 months.

How can I achieve this using the Rules module?
Answering my own question.

I have finally done this using hook_default_rules_configuration()
I have created a test rule with static values, then exported it and used the hook mentioned above to modify the values on run time.

This worked best for my requirements.