I'm trying to send e-mails using SMTP.
Very simple e-mails work, but once more complex code is included they break. It seems like certain quote characters are not handled correctly.
I see messages like this in the Retool console:
SendEmail failed (0.002s):JSON.parse: expected ',' or '}' after property value in object at line 1 column 38 of the JSON data
For example, the following body of a email DOES NOT work, even though the editor "likes" the syntax and shows the expected string in the "green box".
Hi {{current_user.firstName + " " + current_user.lastName}}, this is a "bad" email
The following body of an email DOES work, even though the editor thinks it's a syntax error.
Hi {{current_user.firstName + " " + current_user.lastName}}, this is a "good" email
Could you share a screenshot of each case? One for an email that works and one that doesn't. It would be great to see the code that breaks it on a screenshot.
Aha! I found it, just use single quotation marks on the Body. It looks like when the Body is parsed, the {{ }} is already turned into a double quotation mark string, which is causing the issue.
That is correct, this is definitely a bug. We created a bug report internally and we'll let you know when it is fixed. On the meantime, use the workaround you like the most.