Sleep

Vue- Email - Vue.js Feed

.Vue-email is influenced by react-email, it permits us generate layouts using the vue structure, with parts that help our team create themes conveniently as well as swiftly.To start using vue-email in any type of vue job, you merely need to have to install the deal:.Along with NPM:.$ npm mount vue-email.Along with Anecdote:.$ anecdote include vue-email.With PNPM:.$ pnpm mount vue-email.Developing email layout.Create a brand new e-mail layout in everywhere you want to have your templates, for this situation, our team can create a layout folder, along with a theme phoned welcome.vue.src/templates/welcome. vue.

label, invited to vue-email.A Vue element collection for structure responsive emails.View on GitHub.Pleased coding!David Arenas.
Providing the design templates.Our company can easily utilize the render functionality, it gets two params, the initial one is the template to make, and the second the params to be utilized for the template, and afterwards pass the result theme in the body of demand.Passing the theme in the body system, offer our company the opportunity of rendering using any kind of server, share, fastify, nuxt in SSR, etc src/pages/index. vue.Send out email with nodemailer.Mailed email.
Send e-mail.In this instance i making use of nuxt v3 because it enables our company to set api inside own venture, and also describe various api courses.Below we simply remove the layout of the demand physical body, and deliver the e-mail passing the layout in the sendMail functionality of the nodemailer bundle.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (celebration) =&gt const body system = await readBody( activity).const testAccount = wait for nodemailer.createTestAccount().const transporter = nodemailer.createTransport( ).const options = from: 'you@example.com',.to: 'user@gmail.com',.subject: 'greetings world',.html: body.template,..await transporter.sendMail( alternatives). ).If you are certainly not using the server in nuxt, you may simply execute on any platform for instance using show:.import share from 'show'.bring in nodemailer coming 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 carrier = nodemailer.createTransport( 'smtp.ethereal.email',.slot: 587,.safe and secure: false,.auth: customer: testAccount.user,.successfully pass: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there planet',.html: layout,..wait for transporter.sendMail( alternatives).return res.json( notification: "Email sent out" ). ).app.listen( 3001 ).Paperwork.Receive the total documents [listed below] ().Elements.You can observe the elements, listed below:.Assimilations.Emails created along with vue-email could be converted into HTML or even.clear text, and sent out utilizing any type of email provider. You can easily view.instances here:.