Choose email address dynamically based on user input

My desire:
Send an email, where receiver email is chosen dynamically, based on a user input.

The input is on 1 page
and
the sending of the email happens at another page (confirmation of order).

Example:
If User chooses Nike, receiver of email = sales@nike.com
If User chooses Adidas, receiver of email = sales@adidas.com

I tried:
I tried to store the email in an invisible text field (using conditions) and try to store that in the db. But was blocked as a text input appearantly isn’t valid as a db input.

I tried to use dynamic data in the email action module for the receiver value. Tried all sorts of things, but zero success.

I’m using this action in my workflow to send the email:
29

One option is to store the email in the db, and load it in the email action module. But I don’t understand how I store it initially.

Any help on this will be highly appreciated! (Also, do I need Sendgrid for sending emails?)

If the process goes over two pages, the most efficient solution may be to store the email address as an URL parameter instead.

Use the Go to page action, and fill in the address (or replace by dynamic value)

image
image

In the Send email action, you fetch the email from the URL:


image

You don’t need it to send emails, but to work with templates or large volumes of mail, you’ll probably want to switch at some point.

1 Like

Thanks for your feedback! I think I failed to frame my issue clearly:

How do I create the logic for choosing the correct value for email depending on the user choise? How can Bubble know which email to use when the user chooses “Adidas” or when user chooses “Nike”?

As far as I can tell, your example is excellent if there was only 1 potential email, but I don’t see how it can work if there are multiple potential emails.

I figured how to solve this in an “ugly” way:

Creating a input that is not visible to the user and use conditionals. For conditionals I set the initial content to be xyz depending on the other input value, then storing this in my db.

Hi @havard.muggerud,

in your case of having multiple emails, choose the way that @petter proposed with this slight change for the email parameter:

For the confirm email page: you can easily retrieve the email through the “Get data from page URL” function inside e.g. a text element.

Hope this helps!

Best,
Julius

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.