Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Simple way to build email templates in vue
After see react-email and svelte-email, i took the decision to build the same idea but for vue 😀, there you can design email templates using vue3 and render them to HTML or simple text.
Now TailwindCSS its supported! You can see here
It's so simple as install the package in your project:
npm install vue-email
yarn add vue-email
pnpm install vue-email
Vue Email provides you a series of components to build a email template
This example is based on Nuxt 3 app
components/template-email.vue
<template>
<e-html lang="en">
<e-text>Hello, {{ user }}!</e-text>
<e-hr />
<e-button href="vuejs.org">Visit vue</e-button>
</e-html>
</template>
<script setup>
import { EButton, EHr, EHtml, EText } from 'vue-email';
import { ref } from 'vue';
const user = ref('Dave');
</script>
This basic example uses Nodemailer and Nuxt 3 to send email. You easily can use other email service provider.
In this example i pass the template by params in a request.
server/api/email.post.ts
import nodemailer from 'nodemailer';
export default defineEventHandler(async (event) => {
const body = await readBody(event);
const testAccount = await nodemailer.createTestAccount();
const transporter = nodemailer.createTransport({
host: process.env.HOST || 'smtp.ethereal.email',
port: 587,
secure: false,
auth: {
user: testAccount.user,
pass: testAccount.pass,
},
});
const options = {
from: 'you@example.com',
to: 'user@gmail.com',
subject: 'hello world',
html: body.template,
};
const info = await transporter.sendMail(options);
return { messageId: info.messageId, previewUrl: nodemailer.getTestMessageUrl(info) as string };
});
You can see the full example here
You can see the documentation here
You can see the components, listed below:
Emails built with vue-email can be converted into HTML or plain text, and sent using any email service provider. You can see examples here:
This a list of features to add in the future:
This project is originally written in react (react-email) by:
This project is licensed under MIT
FAQs
💌 Write email templates with Vue
The npm package vue-email receives a total of 2,141 weekly downloads. As such, vue-email popularity was classified as popular.
We found that vue-email demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.