Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually motivated by react-email, it enables our company make layouts using the vue framework, along with elements that assist our company construct themes simply and quick.To begin utilizing vue-email in any sort of vue job, you simply need to put in the deal:.With NPM:.$ npm put up vue-email.Along with Yarn:.$ anecdote incorporate vue-email.With PNPM:.$ pnpm set up vue-email.Generating email theme.Generate a new e-mail design template in wherever you wish to possess your design templates, for this case, our company may make a design template folder, along with a design template gotten in touch with welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue component public library for structure receptive emails.Viewpoint on GitHub.Happy coding!David Arenas.
Providing the layouts.Our experts may use the make function, it receives pair of params, the 1st one is actually the layout to provide, and also the second the params to become used for the theme, and then pass the end result template in the physical body of demand.Passing the layout in the body, provide us the chance of providing using any server, reveal, fastify, nuxt in SSR, and so on src/pages/index. vue.Send out e-mail along with nodemailer.Sent email.
Send email.In this particular instance i utilizing nuxt v3 since it permits our company to establish api inside very own task, and also describe various api courses.Listed here our team only extract the template of the demand physical body, and also send the e-mail passing the theme in the sendMail feature of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const physical body = wait for readBody( activity).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello world',.html: body.template,..await transporter.sendMail( alternatives). ).If you are actually not making use of the web server in nuxt, you may easily execute on any kind of framework for instance making use of express:.bring reveal coming from 'share'.bring in 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 = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings planet',.html: layout,..wait for transporter.sendMail( alternatives).return res.json( information: "Email sent out" ). ).app.listen( 3001 ).Documents.Get the complete records [right here] ().Components.You can easily see the elements, listed here:.Assimilations.Emails created along with vue-email may be converted into HTML or.clear text, and also delivered making use of any email provider. You can view.examples listed here:.