Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@ahmedayob/email-toolkit
Advanced tools
A powerful and flexible toolkit for building, validating, and processing emails with TypeScript. This library offers utilities for handling email headers, attachments, and encoding, making it easier to compose and manage emails programmatically.
@ahmedayob/email-toolkit
A powerful and flexible toolkit for building, validating, and processing emails with TypeScript. This library offers utilities for handling email headers, attachments, and encoding, making it easier to compose and manage emails programmatically.
To install the toolkit, use npm or yarn:
npm install @ahmedayob/email-toolkit
# or
yarn add @ahmedayob/email-toolkit
Here's a quick guide on how to use the library:
Create and configure email headers:
import { EmailBuilderHeader } from "@ahmedayob/email-toolkit";
const header = new EmailBuilderHeader();
header
.setFrom("ahmed <ahmed@gmail.com>")
.setTo("ahmed <ahmed@gmail.com>")
.setCc("ahmed <ahmed@gmai.com>")
.setBcc("ahmed <ahmed@gmai.com>")
.setSubject("this is wild duck email test subject")
.setInReplyTo("ahmed@gmail.com")
.setMIMEVersion("1.0")
.setContentTransferEncoding("quoted-printable")
.setContentType("text/html")
.setCharset("utf8");
Add attachments to your email:
import { EmailBuilderAttachment } from "@ahmedayob/email-toolkit";
import { Base64 } from "@ahmedayob/email-toolkit";
const attachment = new EmailBuilderAttachment();
attachment.addAttachment({
headers: {
"Content-Type": 'text/plain; charset="utf-8"',
"Content-Transfer-Encoding": "base64",
"Content-Disposition": 'attachment; filename="test.txt"',
},
size: 1234,
filename: "test.txt",
mimeType: "text/plain",
attachmentId: "1234",
attachmentContent: Base64.encodeToBase64("test"),
});
Combine headers and attachments to create the final email:
import { EmailBuilder } from "@ahmedayob/email-toolkit";
const email = new EmailBuilder();
email.messagebody = "this is message body";
const finalEmail = email.getRawMessage(header.headers, attachment.attachments);
console.log(finalEmail);
EmailBuilderHeader
EmailBuilderAttachment
EmailBuilder
Base64
Validation schemas are available to ensure data correctness:
Contributions are welcome! Please open issues and pull requests on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.
0.2.0
FAQs
A powerful and flexible toolkit for building, validating, and processing emails with TypeScript. This library offers utilities for handling email headers, attachments, and encoding, making it easier to compose and manage emails programmatically.
The npm package @ahmedayob/email-toolkit receives a total of 1 weekly downloads. As such, @ahmedayob/email-toolkit popularity was classified as not popular.
We found that @ahmedayob/email-toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.