必需: drupal7中的Simplenews模块。
我的网站上有一个内容类型的学生。学生可以来自工程系,管理系,.
我想做的是,每当我添加一个来自工程学的学生,一封邮件会自动发送给订阅用户。我读到了简单新闻模块,并且已经尝试发送一些成功接收到的邮件。
我不能做的,也没有找到有关的信息是如何“链接”的术语工程在部门通讯,然后发送邮件。
发布于 2013-10-03 08:00:07
其中一种相当简单的方法是使用规则模块。
假设只有几个接受者,而不是几百个.
您可以使用“发送电子邮件”操作有条件地向指定收件人发送电子邮件。
下面是一些可以导入的示例规则。
{ "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“角色的所有用户。
更新:
的简单新闻通讯
下面是如何创建和发送带有规则的时事通讯:
{ "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操作在新闻稿节点上设置其他字段值。
https://drupal.stackexchange.com/questions/87624
复制相似问题