Sleep

Vue- Email - Vue.js Feed

.Vue-email is inspired through react-email, it enables our team produce design templates using the vue structure, along with parts that aid us construct layouts conveniently as well as fast.To begin using vue-email in any type of vue venture, you simply require to put in the package:.With NPM:.$ npm set up vue-email.Along with Yarn:.$ yarn include vue-email.With PNPM:.$ pnpm mount vue-email.Generating email theme.Produce a new e-mail theme in no matter where you desire to possess your layouts, for this case, our experts may produce a theme folder, with a layout called welcome.vue.src/templates/welcome. vue.

label, welcome to vue-email.A Vue element library for structure reactive e-mails.Scenery on GitHub.Happy coding!David Arenas.
Rendering the templates.We can utilize the make function, it obtains pair of params, the initial one is the template to make, as well as the second the params to be utilized for the template, and then pass the end result layout in the physical body of ask for.Passing the design template in the body, offer our team the opportunity of rendering utilizing any sort of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send out e-mail with nodemailer.Mailed email.
Send e-mail.Within this example i utilizing nuxt v3 since it enables our company to establish api inside own task, and also specify multiple api options.Here our company just draw out the layout of the demand physical body, and send the e-mail passing the design template in the sendMail function of the nodemailer plan.src/server/api/ email.post.ts.bring in nodemailer coming from 'nodemailer'.export default defineEventHandler( async (activity) =&gt const body system = wait for readBody( celebration).const testAccount = wait for nodemailer.createTestAccount().const carrier = nodemailer.createTransport( ).const choices = from: 'you@example.com',.to: 'user@gmail.com',.target: 'hello planet',.html: body.template,..await transporter.sendMail( alternatives). ).If you are not utilizing the server in nuxt, you can easily implement on any platform as an example using convey:.bring reveal coming from 'convey'.bring in nodemailer from 'nodemailer'.const application = convey().app.use( express.json()).app.post('/ api/send-email', async (req, res) =&gt const template = req.body.const testAccount = await nodemailer.createTestAccount().const carrier = nodemailer.createTransport( lot: process.env.HOST ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.subject matter: 'greetings planet',.html: template,..wait for transporter.sendMail( alternatives).return res.json( message: "Email sent out" ). ).app.listen( 3001 ).Documentation.Acquire the complete documentation [below] ().Elements.You can easily see the elements, listed below:.Integrations.E-mails constructed with vue-email could be exchanged HTML or.clear text, as well as sent out using any e-mail company. You can easily find.instances listed here:.

Articles You Can Be Interested In