Dynamic email recipient based on a field value

  • atcbentley
    Asked on April 25, 2018 at 4:15 PM

    A bit like: https://www.jotform.com/answers/349119-Can-I-have-dynamic-recipient-email-address-that-pulls-in-from-a-field-of-data-entered-by-the-user

    I want to use JotForm on my webpage so people can be emailed thru a contact form. I want the recipient email to be dynamic and be derived from the email on webpage itself. How can I achieve that? Lets say I have a php variable holding the email address of a staff member on the webpage.

    Thanks


  • Mike_G JotForm Support
    Replied on April 25, 2018 at 6:51 PM

    I believe what you are trying to achieve is possible.

    However, we just need to ask for more clarifications.

    To my understanding, the recipient of the email autoresponder depends on the selected/entered staff member (name), correct?

    The name and email address of the staff member can be stored in the form. And with the help of conditions, you can send the email based on the selected staff member.

    How-to-send-to-a-specific-email-address-based-on-a-selection

    You mentioned about prepopulating the email field on the form with the email address from a PHP variable. I believe this is possible by adding the variable as a value of the email in the form's URL that is in the iframe used to embed the form on your website.

    Getting-the-Form-iFrame-Code

    I hope this helps. If, in any case, I have misunderstood your concern, please feel free to let us know and give us more details that will help us understand your concern completely.

  • atcbentley
    Replied on April 26, 2018 at 11:09 AM

    Thanks I was hoping to be able to manipulate the source code of the form to force the recipient email. If you can achieve it let me know. I don't want the form to get the preformatted recipient email off the jotform database.

  • Kevin Support Team Lead
    Replied on April 26, 2018 at 12:17 PM

    Handling the conditions code would be a bit tricky, I would instead suggest you to set up an email autoresponder and insert the email address in the email field with your code, this way the email will be sent to the email field from our end and on your end you will be dynamically changing the email address with your own script. 

    Note that the source is required for this as we do not allow custom scripts in the builder. 

    I hope this helps. 

  • atcbentley
    Replied on April 26, 2018 at 3:46 PM

    Thanks that method works well. I can do it by embedding the form Source Code. Problem 2:

    Captcha refuses to work in  modal windows....tried 3. Conflict with the prototype forms js it appears.
    Also
    is there a limit on how many times the form can be used and does it expire. I want unlimited uses and no expiry.
    .

    Thanks

     

  • Mike_G JotForm Support
    Replied on April 26, 2018 at 4:54 PM

    We are glad to know that my colleague's suggestion works for you.

    As for your other concerns, I have moved them to separate threads considering those questions are about another topic.

    You can use the links to go to the threads:

    Captcha-refuses-to-work-in-modal-windows

    Is-there-a-limit-on-how-many-times-the-form-can-be-used-and-does-it-expire?

    We will be replying to those threads shortly.