Support ticket app to send email with a predefined design template

Hi im creating a support ticket app that is a table with info from mysql db, that works good. Now i need to create an option to send email with the table data but email should have a predefined template with some variables like {{name etc, so if i select another record from table name should be different. So at the end info changes but design should stay the same

how i can achieve that in retool?

thanks

Hi @agaitan026 ! Thanks for your inquiry. You can do this with Retool Email—take a look at the Retool Email quickstart.

Here's the idea:

  1. Create a new resource query, and select Retool Email as the resource.
  2. For the To field, add a variable that represents the address you want to send a message to. For example, if you want it to be a selected record from the table, you could write {{ table1.selectedRow.email}}. Make sure to replace table1 and email with the name of your table and the name of the field that your email addresses are in.
  3. You can do the same thing for the subject and description. For example, if you want to reference someone's name, you can write Thanks for your ticket, {{ table1.selectedRow.name }}. Again. make sure to replace table1 and name with actual values from your app.
  4. Connect some kind of trigger to your new Retool Email query. In my example, I created a button, and set an event handler to call my new query whenever it is clicked.

Here's my example:

Does this answer your question? Is there anything else that I can help with?

1 Like

But i should have diff templates with diff designs like html and im using retool self hosted

@agaitan026 thanks for the additional info! Do you have an SMTP server? If you do, you can try out following the instructions to connect an SMTP resource, and then create an SMTP query.

My colleague Joe has a great thread here on how to format the email using the SMTP resource query.

1 Like

i will try that, or maybe even sendgrid may work for this and i can create templates inside sendgrid.

thanks

You're welcome! Here's a document that explains how to Connect to SendGrid, in case you want to take a look at that as well.

1 Like

i tried smtp method but the html is not working i got a table and a column named message where it have or contains a html code like (i use this option to be able to resend or send again email to X client)

and i call it in smtp like this

image

and i got an email like this:

thank you

Hi @agaitan026

Hm, that looks like valid HTML. Can you try something smaller to test out whether it's an issue with this specific HTML, or whether it's something else? For example:
test_html.png

1 Like

using that example html works, i think retool doesnt support div class etc in that field as html?

Hi @agaitan026

There aren't any restrictions agains using divs. Could you add {{tablaCorreos.selectedRow.cuerpo}} into an HTML component and see if it displays properly in your app, just to test out the HTML from your side?

If that's working, could you share the entire HTML snippet, and we'll try to help you troubleshoot from there?

1 Like

it shows like

now its good, almost, as it should look this like

without those borders, how i can remove that?

here is full code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x - Pastebin.com

Hmm I'm not sure where the borders are being added. One option is to force hide all table borders
image