Need help with creating mail templates with dynamic data and sending it
Summary:
My goal is to send order confirmation emails using Nodemailer and Vue for email templates. I have successfully managed to:
1. Send emails using Nodemailer with SMTP.
2. Create email templates using Vue-mail but I did not use nuxt components? im not sure I am new to this nuxt module. Though I was able to use Tailwind in the email template.
However, I am encountering issues when trying to combine these functionalities.
3 Replies
What I have tried:
1. Sending Emails with Nodemailer:
I have a working implementation that sends emails using Nodemailer. Here is the relevant code:
2. Creating Email Templates with Vue:
I have created a template using Vue components and props. Here is the template:
3. Combining Both:
I tried to combine both functionalities by creating an API endpoint that generates the email HTML and sends the email. Here is the code:
Issues Encountered:
1. When trying to display the email HTML in the page's body, I get warnings like "missing required prop".
2. In the server console, I get the following error:
I am using Pinia for state management and want to pass the data from the Pinia states to the email template and send it with Nodemailer. The checkout store has a
formData
state that contains all the relevant data about the customer like name, email, phone, address, etc.
I would appreciate any guidance or suggestions on how to resolve these issues and successfully combine sending emails with Nodemailer and creating email templates with Vue-Mail.
I did use Claude and Github Copilot for help.