首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >创建特定内容时,Simplenews发送邮件

创建特定内容时,Simplenews发送邮件
EN

Drupal用户
提问于 2013-10-03 07:48:49
回答 1查看 1K关注 0票数 1

必需: drupal7中的Simplenews模块。

我的网站上有一个内容类型的学生。学生可以来自工程系,管理系,.

我想做的是,每当我添加一个来自工程学的学生,一封邮件会自动发送给订阅用户。我读到了简单新闻模块,并且已经尝试发送一些成功接收到的邮件。

我不能做的,也没有找到有关的信息是如何“链接”的术语工程在部门通讯,然后发送邮件。

EN

回答 1

Drupal用户

发布于 2013-10-03 08:00:07

其中一种相当简单的方法是使用规则模块。

假设只有几个接受者,而不是几百个.

您可以使用“发送电子邮件”操作有条件地向指定收件人发送电子邮件。

下面是一些可以导入的示例规则。

1.基本的“发送电子邮件”规则

代码语言:javascript
运行
复制
{ "rules_send_email_notification_engineering" : {
    "LABEL" : "Send email notification (engineering)",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "Mail" ],
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_insert" ],
    "IF" : [
      { "AND" : [
          { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_department" } },
          { "data_is" : { "data" : [ "node:field-department" ], "value" : "engineering" } }
        ]
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "example@example.com,example2@example.com",
          "subject" : "New student record created [engineering]",
          "message" : "Sample message"
        }
      }
    ]
  }
}

您还可以在规则中使用“向角色的所有用户发送邮件”操作,如果存在"Engineering department“角色,则将其发送给分配给”Engineering department“角色的所有用户。

更新:

2.创建和发送带有规则

的简单新闻通讯

下面是如何创建和发送带有规则的时事通讯:

代码语言:javascript
运行
复制
{ "rules_send_email_notification_engineering" : {
    "LABEL" : "Send email notification (engineering)",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "Mail" ],
    "REQUIRES" : [ "rules", "simplenews_rules" ],
    "ON" : [ "node_insert" ],
    "IF" : [
      { "AND" : [
          { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_department" } },
          { "data_is" : { "data" : [ "node:field-department" ], "value" : "engineering" } }
        ]
      }
    ],
    "DO" : [
      { "entity_create" : {
          "USING" : {
            "type" : "node",
            "param_type" : "simplenews",
            "param_title" : "New engineering student record created.",
            "param_author" : [ "site:current-user" ]
          },
          "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
        }
      },
      { "data_set" : { "data" : [ "entity-created:status" ], "value" : "1" } },
      { "entity_save" : { "data" : [ "entity-created" ] } },
      { "simplenews_rules_action_send" : { "node" : [ "entity-created" ] } }
    ]
  }
}

您可以根据需要使用data_set操作在新闻稿节点上设置其他字段值。

票数 1
EN
页面原文内容由Drupal提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://drupal.stackexchange.com/questions/87624

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档