Sleep

Vue- Email - Vue.js Supplied

.Vue-email is motivated through react-email, it enables us create templates using the vue framework, with parts that aid us develop layouts simply and also swiftly.To begin making use of vue-email in any type of vue job, you just need to have to set up the deal:.With NPM:.$ npm mount vue-email.Along with Yarn:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm install vue-email.Generating email design template.Make a brand new e-mail theme in anywhere you intend to have your templates, for this instance, our team can easily develop a template directory, along with a layout called welcome.vue.src/templates/welcome. vue.

title, invited to vue-email.A Vue component library for property reactive e-mails.Sight on GitHub.Happy coding!David Arenas.
Making the templates.Our experts can easily make use of the make feature, it receives two params, the initial one is actually the layout to provide, as well as the second the params to become utilized for the design template, and after that pass the end result design template in the body system of ask for.Passing the theme in the body system, offer us the odds of leaving utilizing any sort of hosting server, express, fastify, nuxt in SSR, and so on src/pages/index. vue.Deliver email with nodemailer.Shipped email.
Deliver e-mail.Within this example i making use of nuxt v3 considering that it allows our company to specify api inside very own job, and also define a number of api routes.Below our experts just draw out the design template of the demand physical body, as well as send the email passing the design template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.import nodemailer coming from 'nodemailer'.export default defineEventHandler( async (event) =&gt const body system = wait for readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there world',.html: body.template,..wait for transporter.sendMail( choices). ).If you are actually certainly not utilizing the server in nuxt, you can conveniently implement on any platform for example making use of reveal:.import convey coming from 'convey'.import nodemailer coming from 'nodemailer'.const application = reveal().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const theme = req.body.const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( lot: process.env.HOST ).const alternatives = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hey there planet',.html: theme,..await transporter.sendMail( alternatives).yield res.json( message: "Email delivered" ). ).app.listen( 3001 ).Paperwork.Get the total documentation [below] ().Parts.You can easily find the parts, listed here:.Combinations.Emails created with vue-email could be exchanged HTML or even.plain text, and sent out utilizing any sort of email service provider. You can view.instances here:.