update tsconfig
This commit is contained in:
parent
8d2d9c3806
commit
5b0f09361b
@ -12,12 +12,24 @@
|
|||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartmail",
|
"gitrepo": "smartmail",
|
||||||
"description": "a unified format for representing and dealing with mails",
|
"description": "A unified format for representing and dealing with emails, with support for attachments and email validation.",
|
||||||
"npmPackagename": "@push.rocks/smartmail",
|
"npmPackagename": "@push.rocks/smartmail",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"keywords": [
|
||||||
|
"email handling",
|
||||||
|
"email validation",
|
||||||
|
"email formatting",
|
||||||
|
"typescript",
|
||||||
|
"email attachment",
|
||||||
|
"smartmail",
|
||||||
|
"email development",
|
||||||
|
"email template",
|
||||||
|
"disposable email detection",
|
||||||
|
"freemail detection"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tsdocs": {
|
"tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
14
package.json
14
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartmail",
|
"name": "@push.rocks/smartmail",
|
||||||
"version": "1.0.24",
|
"version": "1.0.24",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a unified format for representing and dealing with mails",
|
"description": "A unified format for representing and dealing with emails, with support for attachments and email validation.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -42,5 +42,17 @@
|
|||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"email handling",
|
||||||
|
"email validation",
|
||||||
|
"email formatting",
|
||||||
|
"typescript",
|
||||||
|
"email attachment",
|
||||||
|
"smartmail",
|
||||||
|
"email development",
|
||||||
|
"email template",
|
||||||
|
"disposable email detection",
|
||||||
|
"freemail detection"
|
||||||
]
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
135
readme.md
135
readme.md
@ -1,37 +1,122 @@
|
|||||||
# @push.rocks/smartmail
|
# @push.rocks/smartmail
|
||||||
a unified format for representing and dealing with mails
|
a unified format for representing and dealing with mails
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartmail)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartmail)
|
|
||||||
* [github.com (source mirror)](https://github.com/push.rocks/smartmail)
|
|
||||||
* [docs (typedoc)](https://push.rocks.gitlab.io/smartmail/)
|
|
||||||
|
|
||||||
## Status for master
|
To install `@push.rocks/smartmail`, you'll need Node.js installed on your system. With Node.js installed, run the following command in your terminal:
|
||||||
|
|
||||||
Status Category | Status Badge
|
```bash
|
||||||
-- | --
|
npm install @push.rocks/smartmail --save
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartmail/badges/master/pipeline.svg)](https://lossless.cloud)
|
```
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartmail/badges/master/coverage.svg)](https://lossless.cloud)
|
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartmail)](https://lossless.cloud)
|
This will add `@push.rocks/smartmail` to your project's dependencies.
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartmail)](https://lossless.cloud)
|
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartmail)](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartmail)](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartmail)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class intellisense!
|
`@push.rocks/smartmail` provides a unified format for representing and dealing with emails in a Node.js environment. Below, you will find several examples showcasing how to use its main features, including email address validation and creation of mail objects with attachments.
|
||||||
|
|
||||||
## Contribution
|
### Importing the Module
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
First, ensure you're using ESM (ECMAScript Modules) syntax in your TypeScript project. Then, import the necessary classes:
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
```typescript
|
||||||
|
import {
|
||||||
|
Smartmail,
|
||||||
|
EmailAddressValidator
|
||||||
|
} from '@push.rocks/smartmail';
|
||||||
|
```
|
||||||
|
|
||||||
## Legal
|
### Validate Email Addresses
|
||||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
You can validate email addresses to check whether they are disposable, belong to a free email provider, or verify their validity in terms of having an MX record.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Instantiate the EmailAddressValidator
|
||||||
|
const emailValidator = new EmailAddressValidator();
|
||||||
|
|
||||||
|
// Validate an email address
|
||||||
|
const validateEmail = async (email: string) => {
|
||||||
|
const validationResult = await emailValidator.validate(email);
|
||||||
|
console.log(validationResult);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Example usage
|
||||||
|
validateEmail('example@gmail.com').then(() => {
|
||||||
|
console.log('Email validation completed.');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Creating and Using Smartmail Objects
|
||||||
|
|
||||||
|
`Smartmail` class allows you to represent an email in a structured way, including attachments, subject, body, and more. Here's how to use it:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Smartmail } from '@push.rocks/smartmail';
|
||||||
|
import { Smartfile } from '@push.rocks/smartfile';
|
||||||
|
|
||||||
|
// Create a new Smartmail object
|
||||||
|
const myMail = new Smartmail({
|
||||||
|
from: 'no-reply@yourdomain.com',
|
||||||
|
subject: 'Welcome to Our Service',
|
||||||
|
body: 'Hello {{name}}, welcome to our service!'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Use Smartfile to prepare an attachment (optional)
|
||||||
|
const attachment = new Smartfile.fromLocalPath('path/to/your/attachment.pdf');
|
||||||
|
myMail.addAttachment(attachment);
|
||||||
|
|
||||||
|
// Accessing and modifying the mail object's properties
|
||||||
|
console.log(myMail.getSubject({ name: 'John Doe' }));
|
||||||
|
console.log(myMail.getBody({ name: 'John Doe' }));
|
||||||
|
|
||||||
|
// The `getCreationObject` method can be used to retrieve the original creation object
|
||||||
|
console.log(myMail.getCreationObject());
|
||||||
|
```
|
||||||
|
|
||||||
|
### Email Address Validation Details
|
||||||
|
|
||||||
|
The `EmailAddressValidator` class fetches domain information either from a local JSON file or an online source to categorize email domains as disposable, free, or valid based on MX records. Here's a deeper look into validating email addresses and interpreting the results:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Instantiate the validator
|
||||||
|
const validator = new EmailAddressValidator();
|
||||||
|
|
||||||
|
// Validate an email
|
||||||
|
validator.validate('someone@disposablemail.com').then(result => {
|
||||||
|
if (result.valid && !result.disposable) {
|
||||||
|
console.log('Email is valid and not disposable.');
|
||||||
|
} else {
|
||||||
|
console.log('Email is either invalid or disposable.');
|
||||||
|
}
|
||||||
|
if (result.freemail) {
|
||||||
|
console.log('Email belongs to a free mail provider.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Handling Attachments
|
||||||
|
|
||||||
|
As shown in the example, attachments can be added to a `Smartmail` object. `Smartfile` (from `@push.rocks/smartfile`) is utilized to handle file operations, allowing you to attach files easily to your email object. Ensure that attachments are in the appropriate format and accessible before adding them to the `Smartmail` object.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
These examples cover the basics of using `@push.rocks/smartmail` for handling emails within your Node.js applications. By leveraging the `Smartmail` and `EmailAddressValidator` classes, you can efficiently represent, validate, and manage email data, enhancing the robustness and functionality of your email-related features.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||||
|
Loading…
Reference in New Issue
Block a user