Sleep

Vue- Email - Vue.js Feed

.Vue-email is actually inspired through react-email, it allows our team create themes utilizing the vue platform, with parts that assist our company develop themes simply and quick.To begin utilizing vue-email in any kind of vue task, you just require to put in the bundle:.Along with NPM:.$ npm mount vue-email.Along with Yarn:.$ anecdote incorporate vue-email.Along with PNPM:.$ pnpm mount vue-email.Generating e-mail theme.Create a new email layout in wherever you would like to possess your design templates, for this situation, our experts can easily make a template directory, with a theme called welcome.vue.src/templates/welcome. vue.

label, appreciated to vue-email.A Vue part collection for building reactive emails.Viewpoint on GitHub.Pleased coding!David Arenas.
Rendering the design templates.Our experts can easily use the render function, it acquires 2 params, the 1st one is the theme to render, and also the 2nd the params to be made use of for the design template, and afterwards pass the outcome design template in the body of demand.Passing the template in the body system, offer our company the odds of leaving utilizing any hosting server, show, fastify, nuxt in SSR, etc src/pages/index. vue.Send email with nodemailer.Placed email.
Send email.In this particular instance i using nuxt v3 since it allows us to specify api inside personal job, and define various api options.Listed below our experts only draw out the layout of the request physical body, and deliver the e-mail passing the theme in the sendMail function of the nodemailer package deal.src/server/api/ email.post.ts.bring in nodemailer from 'nodemailer'.export default defineEventHandler( async (occasion) =&gt const body = wait for readBody( occasion).const testAccount = await nodemailer.createTestAccount().const transporter = nodemailer.createTransport( multitude: process.env.HOST ).const possibilities = from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hello there globe',.html: body.template,..await transporter.sendMail( choices). ).If you are not making use of the web server in nuxt, you can simply carry out on any kind of platform for example making use of reveal:.import reveal from 'share'.bring in nodemailer from 'nodemailer'.const app = share().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( 'smtp.ethereal.email',.slot: 587,.protected: inaccurate,.auth: user: testAccount.user,.pass: testAccount.pass,.,. ).const options = coming from: 'you@example.com',.to: 'user@gmail.com',.topic: 'hi there world',.html: design template,..wait for transporter.sendMail( choices).gain res.json( notification: "Email sent" ). ).app.listen( 3001 ).Documentation.Obtain the complete documents [right here] ().Components.You may see the elements, listed below:.Integrations.Emails created along with vue-email could be converted into HTML or.clear text, as well as sent out making use of any type of email provider. You can view.examples listed below:.