Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually encouraged through react-email, it enables our team generate themes using the vue framework, along with parts that assist our company develop templates quickly and swiftly.To start using vue-email in any kind of vue project, you just need to set up the plan:.Along with NPM:.$ npm set up vue-email.Along with Anecdote:.$ yarn include vue-email.With PNPM:.$ pnpm set up vue-email.Making e-mail layout.Produce a brand new email template in wherever you intend to have your design templates, for this scenario, our team can easily develop a layout folder, along with a layout phoned welcome.vue.src/templates/welcome. vue.

name, invited to vue-email.A Vue element collection for building receptive e-mails.View on GitHub.Happy coding!David Arenas.
Rendering the themes.We may utilize the make function, it gets 2 params, the 1st one is actually the layout to render, as well as the 2nd the params to be used for the layout, and afterwards pass the outcome design template in the body system of ask for.Passing the design template in the body system, offer our company the chance of leaving making use of any hosting server, convey, fastify, nuxt in SSR, and so on src/pages/index. vue.Send e-mail with nodemailer.Shipped e-mail.
Deliver email.Within this example i making use of nuxt v3 given that it enables our company to specify api inside very own venture, and also specify various api routes.Right here our team simply draw out the template of the demand body, and also send the email passing the theme in the sendMail feature of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export nonpayment defineEventHandler( async (celebration) =&gt const physical body = await readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there planet',.html: body.template,..await transporter.sendMail( options). ).If you are not utilizing the web server in nuxt, you may quickly implement on any platform as an example using show:.bring show coming from 'show'.bring in nodemailer coming from 'nodemailer'.const application = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const design template = req.body.const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( bunch: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello globe',.html: template,..await transporter.sendMail( options).return res.json( information: "Email sent" ). ).app.listen( 3001 ).Information.Obtain the complete information [listed here] ().Elements.You can easily find the components, listed here:.Integrations.Emails constructed with vue-email could be exchanged HTML or even.plain text, and delivered utilizing any kind of e-mail company. You may observe.examples listed below:.