Sleep

Vue- Email - Vue.js Supplied

.Vue-email is actually influenced through react-email, it permits our company develop templates utilizing the vue platform, with elements that assist us create templates easily as well as swiftly.To start using vue-email in any vue job, you just need to have to put in the package:.Along with NPM:.$ npm put in vue-email.With Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm set up vue-email.Generating email theme.Create a new email design template in any place you intend to have your layouts, for this situation, our team can easily produce a theme directory, with a design template gotten in touch with welcome.vue.src/templates/welcome. vue.

name, welcome to vue-email.A Vue part collection for structure receptive e-mails.Sight on GitHub.Satisfied coding!David Arenas.
Rendering the templates.Our company may utilize the leave functionality, it receives 2 params, the initial one is the theme to make, as well as the 2nd the params to become used for the design template, and then pass the end result design template in the physical body of ask for.Passing the layout in the physical body, offer our team the odds of providing using any server, convey, fastify, nuxt in SSR, etc src/pages/index. vue.Send e-mail along with nodemailer.Provided e-mail.
Send email.In this instance i utilizing nuxt v3 given that it allows our company to establish api inside personal task, and determine several api options.Right here our company just remove the theme of the demand body, as well as send the e-mail passing the design template in the sendMail feature of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export nonpayment defineEventHandler( async (activity) =&gt const body system = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const possibilities = coming from: 'you@example.com',.to: 'user@gmail.com',.target: 'hi there globe',.html: body.template,..wait for transporter.sendMail( alternatives). ).If you are actually not making use of the server in nuxt, you may simply execute on any sort of structure as an example using reveal:.bring show 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 design template = req.body.const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( bunch: process.env.HOST ).const options = from: 'you@example.com',.to: 'user@gmail.com',.target: 'greetings planet',.html: template,..await transporter.sendMail( possibilities).yield res.json( notification: "Email sent out" ). ).app.listen( 3001 ).Information.Acquire the full documentation [here] ().Components.You may find the parts, listed here:.Assimilations.E-mails constructed with vue-email can be converted into HTML or even.plain text, and sent utilizing any kind of email service provider. You can easily view.examples listed below:.