2
I am creating a function for sending email via nodemailer, and our have some templates that are for specific cases.
I need a function that once you receive the Welcome template for example, automatically change some fields (tags).
For example, I will send: 'Olá {Nome}, bem vindo!'
I need you to take the value of the database and change, for example: 'Hello {Nome, bem vindo!'
> 'Olá João, bem vindo!'
Or login: 'Seu login é {Login}'
.
I need you to take Mysql.
(Sample code)
var mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Testes de envio de e-mail',
html: '<p>Seu usuário é {Usuario} e senha é {Senha}</p><p>Olá {Nome}, seja bem vindo!'
};
Ever thought of using strings template?
– Luiz Felipe
If the answer below solved your problem and there was no doubt left, mark it as correct/accepted by clicking on the " " that is next to it, which also marks your question as solved. If you still have any questions or would like further clarification, feel free to comment.
– Sorack