How to send an email using a field key? I am attempting to send an email to a field selected value using the Rules module.
The user selects a faculty member and saves the node. The rule should fire off and email based on the field's key. I have the field set up as: 


  john@email.com|Doe, John


I am attempting to send to the key using [node:field-advisor-:key] as a replacement pattern. But I think it's still trying to send to the label.

I am still very new to Drupal so my vocabulary and skills are relatively limited.

Here is the exported rule:

  { "rules_email_to_adviser" : {
  "LABEL" : "Email to Adviser",
  "PLUGIN" : "reaction rule",
  "OWNER" : "rules",
  "REQUIRES" : [ "rules" ],
  "ON" : { "node_insert--timeclock" : { "bundle" : "timeclock" } },
  "IF" : [
        { "user_has_role" : { "account" : [ "node:author" ], "roles" : { 
        "value" : { "20" : "20" } } } },
       { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_advisor_" } }
    ],
  "DO" : [
    { "mail" : {
        "to" : "[node:field-advisor-:key]",
        "subject" : "Time Card Submitted for Review",
        "message" : "[node:author] has submitted a time card for your approval. \r\n\r\nPlease review the time card at: [node:edit-url]\r\n\r\nThank you.",
        "language" : [ "" ]
      }
    }
  ]
  }
}


Notes:


All of the faculty members (such as "John Doe") have accounts on the site.
If it would help (simplify things) to make the rule work, I'm OK with replacing the implementation of that field_advisor_-field by a more appropriate field (with similar functionality).
Part 1: Review the definition of your field

Assuming that all of the faculty members have an account on your site (as you confirmed in one of your comments), I recommend to replace the implementation of that field_advisor_-field. I.e. delete that field in your timeclock content type, and add a more appropriate field that looks like so:


Field Name = Anything you want, say with a machine name like field_timeclock_reviewer
Field Type = Entity Reference, with Target type = user and Number of values = 1 (pick any of the other options to define this field as you see fit).


By using this field, you don't have to maintain the data of that field as in your example with john@email.com|Doe, John (instead you take advantage of the already administered userids and their corresponding eMail IDs).

Note: to limit the list of users that can be referenced to only those users with a specific role (like "faculty"), you should use Views "Entity selection mode" for your entity reference field in the Entity Reference widget. But before you can select the appropriate "View" to do so, you should create a view (with the Views module) to create a list of all users with that specific role.

Part 2: Rule to send the eMail

After you adapted the setup of your field as described above, it is straight forward to write a rule for the Rules module to send such eMail that you're looking for.

Here is a sample of such rule (in Rules export format), which will send such eMail to the userid selected via the field field_blog_reviewer (= a field I added to my "Blog" content type that is defined as an entity reference to a 'user'), and this whenever a new node of content type "Blog" is saved:

{ "rules_notify_reviewer_about_outstanding_approval" : {
    "LABEL" : "Notify reviewer about outstanding approval",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--blog" : { "bundle" : "blog" } },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_blog_reviewer" } }
    ],
    "DO" : [
      { "mail" : {
          "to" : "[node:field-blog-reviewer]",
          "subject" : "Blog Post waiting your approval",
          "message" : "[node:author] has submitted a new Blog post waiting your approval.\r\n\r\nYou can review it at: [node:edit-url].",
          "language" : [ "" ]
        }
      }
    ]
  }
}


If in the above exported rule you'd change "blog" to "timeclock" (before importing this rule in your environment), and after you also add that extra user_has_role condition (as in your question), you should be pretty close to getting it to work (with an eMail that is similar to what you wanted it to be).