Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually motivated through react-email, it allows our team produce design templates using the vue framework, along with elements that help our team create templates quickly and also swiftly.To begin making use of vue-email in any kind of vue task, you only need to have to put up the package:.With NPM:.$ npm put in vue-email.Along with Yarn:.$ anecdote add vue-email.Along with PNPM:.$ pnpm set up vue-email.Creating email template.Generate a new email theme in anywhere you desire to have your templates, for this situation, we may create a template file, along with a layout contacted welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue element collection for property responsive e-mails.Perspective on GitHub.Pleased coding!David Arenas.
Providing the layouts.Our company may make use of the provide feature, it acquires pair of params, the very first one is the layout to render, as well as the second the params to be used for the layout, and afterwards pass the outcome template in the body of demand.Passing the layout in the body system, give our company the opportunity of making utilizing any sort of server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email along with nodemailer.Sent e-mail.
Send email.In this instance i using nuxt v3 considering that it allows our company to set api inside personal task, as well as define a number of api courses.Listed below our team just remove the template of the demand body, as well as send the e-mail passing the design template in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (event) =&gt const physical body = wait for readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'hey there globe',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are certainly not using the web server in nuxt, you may conveniently carry out on any kind of platform for instance making use of express:.import show coming from 'reveal'.import nodemailer from 'nodemailer'.const application = show().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( multitude: process.env.HOST ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there planet',.html: design template,..await transporter.sendMail( possibilities).return res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Records.Receive the complete paperwork [listed below] ().Parts.You can easily view the parts, listed here:.Combinations.Emails developed with vue-email may be exchanged HTML or.plain text, as well as sent out making use of any sort of e-mail service provider. You may observe.instances here:.