我有一种内容类型,其中包含关于人们的信息,如果这些人希望将这些信息转发给他们,我希望能够捕获电子邮件字段中的电子邮件,并在电子邮件中将已发布的内容发送给他们。
我一直在寻找一种方法来做这个,但什么也找不到。有办法这样做吗?
发布于 2016-07-14 07:45:29
下面是一个规则的示例(以规则导出格式),该规则将“在更新现有内容之后”发送eMail,该规则与问题中的内容类似:
{ "rules_notify_author_of_selected_field_updates" : {
    "LABEL" : "Notify author of selected field updates",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_update" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_optionlist" } },
      { "NOT data_is" : {
          "data" : [ "node-unchanged:field-optionlist" ],
          "value" : [ "node:field-optionlist" ]
        }
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "[site:current-user:mail]",
          "subject" : "Notification about a node with a special field value",
          "message" : "Go checkout the node with nid [node:nid] and title [node:title]: it has a field with a value (which is [node:field-optionlist]) you asked to be informed about ..."
        }
      }
    ]
  }
}进一步解释上述示例的更多细节:
field_optionlist的选择列表字段,以及一些可能的值。更改field_optionlist的字段名以匹配内容类型的字段名,并调整实际的eMail详细信息(主题等)以满足您的需要。然后在您自己的站点中导入它(使用规则UI)。就这样。
PS:如果您想将这样的eMails发送给没有登录的人,只需将" to“值更改为节点中eMail字段中指定的eMail ID。但是(红旗!):我不建议您允许匿名用户使用此功能。因为垃圾邮件发送者会喜欢它:他们只需编辑这样的节点,然后键入他们想要的任何eMail Id到您的节点的内容被垃圾邮件.不是个好主意对吧?
https://drupal.stackexchange.com/questions/206980
复制相似问题