1

The following rule works fine, only it adds always a blank before and after the emailaddress in the database table . And that gives an error when sending the newsletter.

{ "rules_webform_block_to_simplenews" : {
    "LABEL" : "Webform Block to simplenews",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "webform_rules", "rules", "simplenews_rules" ],
    "ON" : { "webform_rules_submit" : [] },
    "IF" : [
      { "webform_has_id" : {
          "form_id" : "webform-client-form-113",
          "selected_webform" : { "value" : { "webform-client-form-113" : "webform-client-form-113" } }
        }
      }
    ],
    "DO" : [
      { "simplenews_rules_action_subscribe" : { "mail" : "[data:e_mail-value]", "tid" : "211", "confirmation" : "2" } }
    ]
  }
}

1 Answer 1

1

You didn't mention in your question what the data type is for that e_mail component. But you may want to experiment a bit to see if your problem is resolved by using token [data:e_mail-value-raw] instead of [data:e_mail-value].

Here is a quote from the description (in the Rules UI) about such "raw" values:

The raw value of the selected component, e.g. "email-value-raw". However this is not cleaned up by check_plain(). This is raw user input so take care if you use this somewhere else.

If the above doesn't help, I'd also check if adding (some or all of) these Rules Actions would help (before your existing rules Action):

  • Add a variable, eg email_id
  • Set a data value for that email_id, to assign it the value [data:e_mail-value]
  • Convert data type of that email_id field (which you then use in your existing Rules Action).
2
  • it's an emailaddressfield
    – jimi
    Commented Feb 19, 2018 at 10:16
  • data:e_mail-value-raw solved the problem - thx
    – jimi
    Commented Feb 19, 2018 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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