1

I have set up a rule that is as follows:

  • Rules Event: After saving new content of type Article.
  • Rules Conditions: User has role(s), with role = Authenticated user.
  • Rules Actions: Send mail to all users of a role, with role = Administrator.

When anyone adds an article to the site, all the admins are notified and I have used token replacements for the email fields like so:

  • Mail Subject: [node:author] has just created a piece of content entitled "[node:title]"
  • Message Body:

    [node:author] has just created a piece of content entitled "[node:title]"

    You can see the article here and proof read: [node:edit-url]

    The article is here: [node:url]

This all works perfectly, however I want to also add the author of the node into this email so that any of the admins can email this person if they need to. I cannot work out how to get the author's email into the email body as it doesn't seem to show up in replacement patterns.

Anyone any idea how I can achieve this?

0

2 Answers 2

1

It is not listed among the replacement tokens, but you can use the [node:author:mail] token.

1

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 (as in this question here). However you won't find it by simply expanding the typical "REPLACEMENT PATTERNS"-link that show up by default.

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:"). After doing so, 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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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