Sleep

Vue- Email - Vue.js Nourished

.Vue-email is inspired through react-email, it enables us develop themes utilizing the vue structure, with parts that assist us construct themes simply and fast.To begin utilizing vue-email in any type of vue job, you merely need to put up the plan:.With NPM:.$ npm set up vue-email.With Anecdote:.$ anecdote include vue-email.Along with PNPM:.$ pnpm put up vue-email.Producing e-mail design template.Develop a new email layout in any place you intend to possess your design templates, for this situation, our team can develop a theme folder, with a template gotten in touch with welcome.vue.src/templates/welcome. vue.

name, appreciated to vue-email.A Vue component collection for building receptive emails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Providing the design templates.We can easily make use of the render feature, it receives 2 params, the initial one is the design template to provide, as well as the second the params to become utilized for the layout, and after that pass the outcome design template in the body of demand.Passing the template in the body system, provide us the possibility of providing using any type of hosting server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email with nodemailer.Mailed email.
Deliver e-mail.In this example i using nuxt v3 due to the fact that it allows us to set api inside very own task, as well as specify numerous api paths.Here our company merely draw out the layout of the request body system, and send the email passing the template in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const body system = wait for readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( 'smtp.ethereal.email',.port: 587,.protected: inaccurate,.auth: user: testAccount.user,.elapsed: testAccount.pass,.,. ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings world',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually not using the server in nuxt, you may easily execute on any kind of platform as an example using reveal:.bring share coming from 'reveal'.bring in nodemailer coming from 'nodemailer'.const application = share().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const layout = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( bunch: process.env.HOST ).const alternatives = from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hey there globe',.html: design template,..await transporter.sendMail( possibilities).return res.json( notification: "Email delivered" ). ).app.listen( 3001 ).Records.Receive the total records [listed below] ().Components.You can find the elements, listed below:.Combinations.E-mails created with vue-email may be converted into HTML or even.clear text, and delivered using any kind of email specialist. You can easily find.instances here:.