Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Osman Coskun 170 posts 404 karma points
    Feb 16, 2017 @ 06:17
    Osman Coskun
    1

    Change recipient e-mail with checkbox or dropdown

    One of my client wants Umbraco Forms to send messages to different recipients (departments) with a selection of checkbox or dropdown.

    I tried to set recipient addresses (e.g. [email protected], [email protected], [email protected]) and set the variable name as {recipient} in workflow.

    Messages sent to the predefined addresses without problem.

    The problem is client don't want to expose the e-mail addresses. He wants the dropdown to display labels instead.

    Any advice?

    TIA

    Ps. I have UmbracoForms.Package.4.2.1 installed.

  • OleP 67 posts 276 karma points
    Mar 03, 2017 @ 16:01
    OleP
    0

    I urgently need this, for the exact same reason as OP. Client want to list departments in the dropdown, not emails (Sales, Support, HR ect.).

    Surely someone must've solved this issue before? - It's a quite common case, and I'm really surpriced that Forms does not support this out of the box.

    Thanks!

  • Shola 65 posts 273 karma points
    Mar 03, 2017 @ 17:51
    Shola
    0

    Unfortunately that may need to be a custom workflow; i.e. "Send form to URL" would be the workflow to POST to, and the URL would be a custom surface controller that would hold all the code needed to send an email.

    I know... :(

  • OleP 67 posts 276 karma points
    Mar 05, 2017 @ 10:35
    OleP
    0

    That could work as a last resort. But it removes the possibility for the client, to make the forms without me interfering.

  • Osman Coskun 170 posts 404 karma points
    Mar 05, 2017 @ 09:35
    Osman Coskun
    1

    I managed to send e-mails to different recipients selected via dropdown.

    First i set dropdown with the username portions of e-mail address before @ (support for [email protected], sales for sales @domain.com). The question title is recipient

    The second step is to concatenate the form field recipient with domain in the receiver email field of workflow settings like :

    {recipient}@domain.com

    The form will be delivered to selected recipient.

    Ps. This is meaningfull if the recipient address is one word only like career@, info@ or support@

    Hope this helps.

  • OleP 67 posts 276 karma points
    Mar 05, 2017 @ 10:29
    OleP
    0

    Thanks, that could work. Do you know where I can find a list of the merge tags in Forms? For example "{recipient}".

  • Osman Coskun 170 posts 404 karma points
    Mar 05, 2017 @ 11:04
    Osman Coskun
    0

    { } is used for {formFiedName}

    [ ] is used for populating the field from page property fields [propertyAlias]

    These are the ones i use.

    More options can be seen on : https://our.umbraco.org/forum/umbraco-pro/contour/15471-Default-values-parameters-from-session

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 05, 2017 @ 14:23
    Dennis Aaen
    1

    Hi Ole,

    You can find a list of the merge tags in Forms? For example "{recipient}" here https://our.umbraco.org/documentation/Add-ons/UmbracoForms/Developer/Magic-Strings/

    Hope this helps,

    /Dennis

  • OleP 67 posts 276 karma points
    Mar 05, 2017 @ 17:15
    OleP
    0

    Thanks. I looked in the documentation, but didn't think to look for "Magic strings" :)

  • Shola 65 posts 273 karma points
    Mar 05, 2017 @ 23:02
    Shola
    0

    That's an interesting workaround. Another caveat is that the email address isn't truly obfuscated--someone could probably guess the formula.

    However, the [%SomeSessionOrCookieItem] string provides an avenue for both true obfuscation and flexible dropdown strings:

    • Your client could enter in the dropdown items however they want (even with spaces--for example "Support Team", "Human Resources").
    • You'd create a new template-less document type (perhaps call it "Form Settings"), and add a textarea property to it. Add a content item to your site using this doctype.
    • Your client would paste the same list of dropdown items into the above textarea property, pipe-delimited by their associated email addresses. Like so:

    Support Team|[email protected]

    Human Resources|[email protected]

    ...

    • On the front end, you'd attach a javascript onchange event to the dropdown, which sends the server an ajax request containing the dropdown's selected value.
    • Your server code would use that value and the "Form Settings" doc to lookup the associated email address. Then your code would set the SomeSessionOrCookieItem session variable to that email address.
    • Then when the visitor submits the form, your workflow would use the [%SomeSessionOrCookieItem] magic string as the recipient.

    Note--the pipe-delimited text area is just one quick-and-dirty way to store key/value pairs as client-editable content, but you get the gist :)

Please Sign in or register to post replies

Write your reply to:

Draft