Sleep

Vue- Email - Vue.js Nourished

.Vue-email is actually motivated by react-email, it enables our company generate themes making use of the vue structure, along with elements that assist our team create design templates quickly and also fast.To start making use of vue-email in any kind of vue venture, you just require to mount the bundle:.With NPM:.$ npm mount vue-email.Along with Anecdote:.$ yarn add vue-email.With PNPM:.$ pnpm set up vue-email.Making email layout.Make a new e-mail theme in anywhere you intend to possess your themes, for this instance, we can create a design template file, along with a layout gotten in touch with welcome.vue.src/templates/welcome. vue.

title, appreciated to vue-email.A Vue component library for property receptive e-mails.Viewpoint on GitHub.Satisfied coding!David Arenas.
Making the templates.We can make use of the leave feature, it receives pair of params, the initial one is actually the layout to render, and the second the params to become utilized for the layout, and after that pass the result layout in the body system of demand.Passing the layout in the physical body, give our team the odds of making making use of any type of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Deliver email with nodemailer.Directed e-mail.
Deliver email.In this instance i utilizing nuxt v3 considering that it permits our team to establish api inside personal project, and also define numerous api courses.Listed here our experts simply remove the layout of the demand body, as well as send out the e-mail passing the layout in the sendMail feature of the nodemailer package.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (event) =&gt const physical body = wait for readBody( occasion).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there world',.html: body.template,..wait for transporter.sendMail( options). ).If you are actually certainly not using the server in nuxt, you can conveniently execute on any structure for instance using reveal:.bring express coming from 'show'.bring in nodemailer 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( lot: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'hello world',.html: layout,..wait for transporter.sendMail( possibilities).profit res.json( message: "Email delivered" ). ).app.listen( 3001 ).Documentation.Get the full documentation [listed here] ().Parts.You can view the parts, listed here:.Combinations.Emails built along with vue-email can be converted into HTML or even.plain text, and delivered using any sort of email specialist. You can easily find.instances right here:.