5

I am having the toughest time figuring out how to send an email to the node author. I created my rule and everything works if I hard code the email but I can't seem to get the right token to use and it seems the tokens available only allow:[node:author] nothing for the node authors email?

  • 1
    I am literally going through this right now for my own use case. VBO has an available token. Try [node:author:mail] and see if it validates in Rules. – user842 Oct 12 '12 at 18:35
  • That worked thanks! I could have swore that I tired that but it might have been [node:author-mail]. Also what is VBO? I will flag this as answered when it allows me to. – Brian Oct 12 '12 at 18:53
  • I added my comment as an answer below if you wish to mark it as correct. You can read about VBO at drupal.org/project/views_bulk_operations – user842 Oct 12 '12 at 20:44
11

I have noticed that some tokens do not show up in Rules sometimes. So try just manually inputting [node:author:mail]` and see if it validates in Rules.

  • Great! I do confirm this tag works. – Nick Jan 14 '16 at 1:12
0

Also, the user is logged in when creating the node so:

<?
global $user;
echo $user->mail;
?>

Should work too.

0

The Rules module is great, but it also has its hidden features ... Yes the "token for the eMail Id of the node author" is available to use it in the Rules Action. However you won't find it by simply expanding the typical "REPLACEMENT PATTERNS"-link that show up by default.

Moreover, there is no need for guessing or trial-and-error (similar to the "So try just manually inputting [node:author:mail]` and see if it validates in Rules" in the accepted answer). Instead, whenever you're looking for some token that at first doesn't seem to be available, you should try to use the Switch to data selection button as in this screenprint:

enter image description here

Then select "node...(Created content)" from the Data selector selection list (or if you know part of what you're looking for just start typing "node:"). Here is another screenprint that should look pretty similar:

enter image description here

After completing such selection, the list of possible values (= tokens starting with "node:") will change and start to show (dozens of) other values such as:

  • node:nid (Node ID)
  • node:type (Content Type)
  • node:author... (Node Author)
  • node:comment (Comments allowed)
  • node:comments... (Comments)

In the above list, note the ones that have a "...": those are the ones that, after you select any of them, will bring up yet another list of tokens that start with what you selected. So if you select "node:author... (Node Author)", it'll show (many) other values (some with yet another "..."), such as:

  • node:author:uid (User ID)
  • node:author:name (Name)
  • node:author:mail (Email)
  • node:author:roles... (User roles)

So there you are: using the drill-down approach as shown above, node:author:mail (Email) is what you're looking for. All that's needed now, is to select it from this list. Though in this case there is no more Label and Description for the token, you only have what's shown between "(" and ")" to decide about which token to select.

PS: If you don't find what you're looking for (after using the Switch to data selection button), you can always return to the previous display by using the Switch to the direct input mode button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.