根据下拉列表中的选择,将 TYPO3 EXT:powermail 邮件发送到不同的收件人 [英] Send TYPO3 EXT:powermail mail to different receivers depending on selection in a dropdown

查看:25
本文介绍了根据下拉列表中的选择,将 TYPO3 EXT:powermail 邮件发送到不同的收件人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常需要根据表单中选择字段的选择向不同的接收者发送 Powermail 表单.我使用 TYPO3 7.6.x 和 Powermail 3.3.0这怎么办?

I often have the requirement to send a powermail-form to different receivers depending on a selection of a selectfield within the form. Im using TYPO3 7.6.x and Powermail 3.3.0 How can this be done?

推荐答案

在 EXT:powermail 的 slackchannel 中@alex-kellner 的帮助下,我找到了一个非常简单的解决方案:

With the help of @alex-kellner in the slackchannel of EXT:powermail i found a quite easy solution for that:

基本上需要两个步骤:

第一步

选择字段中选项的值.您需要在选择字段中为您的选项添加值.这可以通过将管道 | 附加到您的选项并简单地添加值

Values for the Options in the select field. You need to add values to your option in the select field. This can be done by appending a pipe | to your option and simply add the value

MyRecieverEmail 1 | 1

MyRecieverEmail 2 | 2

MyRecieverEmail 3 | 3

除此之外,您还需要知道您的字段的标记/变量/单个字段名.您可以在字段的 extended 选项卡中找到该名称.

In addition to that, you need to know the marker / variable / individual fieldname of your field. You can find that name in the extended tab of your field.

如果需要,您还可以为该字段指定一个自己的"变量名称.变量用 {} 包裹,但您不会在第 2 步

You can also give this field an "own" variable name if needed. The variable is wrapped with {} but you will not these in step 2

第 2 步

现在您需要在设置字段中添加一些 TS.

Now you need to add some TS in your setupfield.

背景信息:基本上这会改变表单的接收者:

Background information: Basically this changes the reciever for a form:

plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = your@email.com

现在您需要检查在表单中选择了哪个选项.这是由全局条件完成的:

Now you need to check wich option was choosen in the form. This is done by a global condition:

[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]

其中 yourVariableFieldname 是字段中 extended 选项卡中的单个字段名,1 是第一个选项的值 (MyRecieverEmail 1)

Where yourVariableFieldname ist the individual fieldname from the extended tab in the field and 1 is the value of the first option (MyRecieverEmail 1)

通过使用此 TS,如果在表单中选择第一个选项 MyRecieverEmail 1,表单将发送到 your@email.com:

By using this TS, the form will be send to your@email.com if the first option MyRecieverEmail 1 is choosen in the form:

[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = your@email.com
[global]

您现在可以根据需要添加任意数量的条件.完整的例子是:

You can now add as much conditions as you need. The complete example would be:

[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 1]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yourfirst@email.com
[global]
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 2]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yoursecond@email.com
[global]
[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 3]
plugin.tx_powermail.settings.setup.receiver.overwrite.email = TEXT
plugin.tx_powermail.settings.setup.receiver.overwrite.email.value = yourthird@email.com
[global]

请注意,这将负责您的 TYPO3-Install 中包含该 TS 的字段名称为 {yourVariableFieldname} 的每个字段.如果您在多个表单中完全像这样使用此字段,这将非常有用.如果你不想让这个负责你有两个选择来避免这种情况:

Please be aware that this will be in charge for every field with the fieldname {yourVariableFieldname} in your TYPO3-Install where this TS is taken into account. This can be useful if you use this field exactly like this in multiple forms. If you dont want this to be in charge you have 2 options to avoid this:

  1. 仅将 TS 放置在您的表单所在的页面上.

  1. only place the TS on the Page where your form is located.

您可以将其添加到您的全局条件中:

You can add this to your global condition:

&&[globalString = GP:tx_powermail_pi1|mail|form = 123]

&& [globalString = GP:tx_powermail_pi1|mail|form = 123]

其中 123 是表单的 ID.

Where 123 is the ID of your form.

这看起来像这样:

[globalString = GP:tx_powermail_pi1|field|yourVariableFieldname = 2] && [globalString = GP:tx_powermail_pi1|mail|form = 123]

这篇关于根据下拉列表中的选择,将 TYPO3 EXT:powermail 邮件发送到不同的收件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆