FormBuilder Sending form to different emailaddress on select option value

I wonder if there’s a way to make a select dropdown menu in the FormBuilder with recipient emailaddresses as values so the submitted form can go to a different emailaddress depending on the selected value.

Now you could only use a single emailfield in the form or enter a default emailaddress to which the entries will be sent.

I’m not a real programmer, but maybe someone has a workaround?

No one? Is there more information needed?

Looking at this line in the plugin code and the info about multiple recipients in the Email-docs it definitely looks doable. I personally don’t use this plugin though.

Thanks, I’m not very proficient in PHP and the subject of sending email with kirby.
My usecase is for a site on which people select a division from a company from a select dropdown menu, so each option inside is a different emailaddress.

So every entry only allows one receiver, but it depends on the chosen option in the select menu

Maybe it’s very easy but I can’t quite imagine how I would do this.

The main reason in using this formbuilder is that the client can maintain all the emailaddresses in the form through the Kirby Panel

If you extend formbuilder.yml (or create your own instead), you could change the email field type here:

 fb_email_recipient:
    type: email
    label: Recipient Email Address
    placeholder: john@example.com
    width: 2/3
    help: Email address that will receive the form emails.
    when:
      fb_form_settings: true
      fb_send_email: true

to a select field with your options instead. After that change, no further changes should be necessary. (Unless you need multiple recipients, then you’d have to change the plugin’s core, it seems, because it only sends to a single recipient).

@texnixe thanks for your answer, I’m going to try this!

@texnixe This is what I’m working on:

I struggle with the query, how should I address the menu-items in the select and the label and value?

I copied the code from the fb_email_sender_field but that query’s not intended for my select form field

There’s no such thing as menuItem and I don’t see label_nameor field_name, so it should probably be structureItem.item_label and structureItem.item_value.

Thanks @pixelijn does the fetch look ok then, because that’s also the copied value from the fb_email_sender_field

So what I suggested doesn’t work? I’ve never used this plugin, so without a closer look I can’t tell (but don’t have time for a closer look now).