In order to send an email to the user with 7 days of inactivity. Do the following:
A. Install Rules and Scheduler where Scheduler depends upon Tokens and Entity API
B. Once you have installed and enabled all the above modules, then you can start configuring your rule. To achieve what you want, do the following steps:
- Add new rule (Configuration -> Workflow -> Rules)
- Give it a name (i.e. user_login ) and select the event as "User has logged in", leave the tags field out and Save the rule
- After saving the Rule, go back to Rules using the breadcrumb (i.e. URL), when you are back in the Rules window, you should see your recently created rule (i.e. user_login)
- Select Component from top-right-hand-side-of-the-page (There should also be a tab named Scheduler, if not there then enable the module)
- Inside component, select Add new component
- Choose Action set as Component plugin and press Continue
- Give it a name (i.e. send_email_to_inactive_user)
- Skips Tag
- From Variables section, Choose DATA TYPE as User, give it a LABEL (i.e. inactive_user), give it a MACHINE name (i.e. inactive_user), ignore USAGE and press continue and the page should refersh.
- Now under Actions add an Action
- Select Send email
- TO, click on switch to Data Selector then reference the label of variable created in previous screen (i.e. inactive-user:mail) colon mail
- Provide a subject to your email
- Provide a message to your email
- Provide a from to your email
- Then save, now you should see the send_email action which is attached to the component.
- Go to the Rules and create an Action for your rule with event (User has log in)
- Select the value of action as Schedule component evaluation and it should open a window with combo box containing your recently created component (i.e. send_email_to_inactive_user), choose it
- for * Schedule Evaluation Date * provide a value (i.e. +10 minutes or +7 days or +15 weeks)
- for Identifier provide a value that will help you identify the scheduled task among other tasks (i.e. 7 days inactive reminder for [account:uid], where the [account:id] is replaced by the logged-in-users-id)
- Last option, select account for INACTIVE_USER's data selector
- Save and you should see the schedule component evaluation under Actions
You are done. If you pay close attention, the Rules evaluates The component when a User log in, the component then schedules an email to be send to the user +7 days (or override the existing one, updating the schedule time duration) and the scheduler sends the email when the time come. So Rule is used to evaluate the component and component is used to setup/update scheduler and scheduler is used to send the email.
In case you have not followed me, or can't figure out then here are my working sample exports for Rule & Component, just import them and change the values accordingly and save. Test it by logging in and then go to Configuration -> Workflow -> Rules -> Schedule and you should see a scheduled event for exactly (i.e. +7 days or +10 minutes from the time you login).
Important component first:
{ "rules_send_email_to_inactive_user" : {
"LABEL" : "send_email_to_inactive_user",
"PLUGIN" : "action set",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "inactive_user" : { "label" : "inactive_user", "type" : "user" } },
"ACTION SET" : [
{ "mail" : {
"to" : [ "inactive-user:mail" ],
"subject" : "test inactive user",
"message" : "test inactive user message",
"from" : "raf",
"language" : [ "" ]
}
}
]
}
}
then import the Rule:
{ "rules_user_login" : {
"LABEL" : "user_login",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_scheduler" ],
"ON" : { "user_login" : [] },
"DO" : [
{ "schedule" : {
"component" : "rules_send_email_to_inactive_user",
"date" : "+7 days",
"identifier" : "7 days inactive reminder for [account:uid].",
"param_inactive_user" : [ "account" ]
}
}
]
}
}

To test whether it is working you can execute it right away and you should get the email in your inbox.
Good luck man, if you needed further help, then Google is your best friend.