
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

nano-mail — це модуль для відправки електронних листів за допомогою Nodemailer, зручного для Node.js з використанням nano-format.
Цей пакет дозволяє створювати, форматувати та відправляти електронні листи з вкладеннями, а також визначати одержувачів через поля to, cc та bcc. Він підтримує шаблонізацію HTML-листів та заміну плейсхолдерів у листах, а також відправлення листів за допомогою Nodemailer.
npm install nano-mail
import { Address, Attachment, Email, Target, mailer, mail } from 'nano-mail';
// Створення одержувачів
const target = Target.from({
to: 'ivan@example.com',
cc: 'petr@example.com',
bcc: 'admin@example.com'
});
// Створення листа
const email = new Email({
subject: 'Ваш рахунок',
html: '<h1>Дякуємо за вашу покупку!</h1>',
from: 'Магазин <info@shop.com>',
target: target
});
// Додавання вкладення
const attachment = new Attachment({
filename: 'invoice.pdf',
path: '/path/to/invoice.pdf'
});
email.attach(attachment);
// Налаштування транспорту для Nodemailer
const transportConfig = {
host: 'smtp.example.com',
port: 587,
secure: false, // true для 465, false для інших портів
auth: {
user: 'username',
pass: 'password'
}
};
// Відправка листа
const data = {
name: 'Іван',
purchase: 'товар 123'
};
mail(email, data, { mailer: mailer(transportConfig) })
.then(info => {
console.log('Лист відправлено:', info);
})
.catch(err => {
console.error('Помилка під час відправлення листа:', err);
});
Address представляє електронну адресу.
new Address(name: string, address: string)toString(): Повертає адресу у форматі "Name ".toObject(): Повертає об'єкт з полями name та address.static from(source: string | object): Address | null: Створює екземпляр з рядка або об'єкта.Attachment представляє вкладення до листа.
new Attachment(opts: object)formatForNodemailer(): Форматує вкладення для Nodemailer.Email представляє електронний лист.
new Email(opts: object)attach(attachment: Attachment): Додає вкладення до листа.formatForNodemailer(): Форматує лист для Nodemailer.Target представляє одержувачів листа.
new Target()add(type: 'to' | 'cc' | 'bcc', address: string | Address | string[] | Address[]): Додає адресу до відповідного поля.formatForNodemailer(): Форматує одержувачів для Nodemailer.static from(source: string | object): Target | null: Створює екземпляр з рядка або об'єкта.mailer створює поштовий транспорт для Nodemailer.
mailer(transportConfig: object): objectmail відповідає за відправку листа.
mail(email: Email, data: object, opts?: object): Promise<object | boolean>Цей проект ліцензований за умовами ліцензії ISC.
FAQs
Mailing with the nodemailer and nano format.
We found that nano-mail demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.