1
+ # Mailtrap Node.js client - Official
2
+
1
3
![ TypeScript] ( https://img.shields.io/npm/types/mailtrap?logo=typescript&logoColor=white&label=%20 )
2
4
[ ![ test] ( https://github.com/railsware/mailtrap-nodejs/actions/workflows/test.yml/badge.svg )] ( https://github.com/railsware/mailtrap-nodejs/actions/workflows/test.yml )
3
5
[ ![ NPM] ( https://shields.io/npm/v/mailtrap?logo=npm&logoColor=white )] ( https://www.npmjs.com/package/mailtrap )
4
6
[ ![ downloads] ( https://shields.io/npm/d18m/mailtrap )] ( https://www.npmjs.com/package/mailtrap )
5
7
6
- # Official Mailtrap Node.js client
8
+
9
+ ## Prerequisites
10
+
11
+ To get the most out of this official Mailtrap.io Node.js SDK:
12
+ - [ Create a Mailtrap account] ( https://mailtrap.io/signup )
13
+ - [ Verify your domain] ( https://mailtrap.io/sending/domains )
14
+
15
+ ## Supported functionality
7
16
8
17
This NPM package offers integration with the [ official API] ( https://api-docs.mailtrap.io/ ) for [ Mailtrap] ( https://mailtrap.io ) .
9
18
10
- Quickly add email sending functionality to your Node.js application with Mailtrap.
19
+ Quickly integrate Mailtrap with your Node.js app.
20
+
21
+ Currently, with this SDK you can:
22
+ - Email API/SMTP
23
+ - Send an email (Transactional and Bulk streams)
24
+ - Send an email with a template
25
+ - Send a batch of emails (Transactional and Bulk streams)
26
+ - Email Sandbox (Testing)
27
+ - Send an email
28
+ - Send an email with a template
29
+ - Message management
30
+ - Inbox management
31
+ - Project management
32
+ - Contact management
33
+ - Contacts CRUD
34
+ - Lists CRUD
35
+ - General
36
+ - Templates CRUD
37
+ - Suppressions management (find and delete)
38
+ - Account access management
39
+ - Permissions management
40
+ - List accounts you have access to
41
+
11
42
12
43
## Installation
13
44
@@ -20,6 +51,7 @@ yarn add mailtrap
20
51
npm install mailtrap
21
52
```
22
53
54
+
23
55
## Usage
24
56
25
57
### Minimal
@@ -51,79 +83,81 @@ client
51
83
.catch (console .error );
52
84
```
53
85
54
- Refer to the [ ` examples ` ] ( examples ) folder for the source code of this and other advanced examples.
86
+ ## Nodemailer Transport
55
87
56
- ### General API
88
+ > NOTE: [ Nodemailer ] ( https://www.npmjs.com/package/nodemailer ) is needed as a dependency.
57
89
58
- - [ List User & Invite account accesses] ( examples/general/account-accesses.ts )
59
- - [ Remove account access] ( examples/general/accounts.ts )
60
- - [ Permissions] ( examples/general/permissions.ts )
90
+ ``` sh
91
+ yarn add nodemailer
61
92
62
- ### Contacts API
93
+ # or, if you are using NPM:
94
+ npm install nodemailer
95
+ ```
63
96
64
- - [ Contacts ] ( examples/contacts/everything.ts )
97
+ If you're using TypeScript, install ` @types/nodemailer ` as a ` devDependency ` .
65
98
66
- ### Contact Lists API
99
+ ``` sh
100
+ yarn add --dev @types/nodemailer
67
101
68
- - [ Contact Lists] ( examples/contact-lists/everything.ts )
102
+ # or, if you are using NPM:
103
+ npm install -D @types/nodemailer
104
+ ```
69
105
70
- ### Templates API
106
+ You can provide Mailtrap-specific keys like ` category ` , ` customVariables ` , ` templateUuid ` , and ` templateVariables ` .
71
107
72
- - [ Templates ] ( examples/templates/everything.ts )
108
+ See transport usage below:
73
109
74
- ### Sending API
110
+ - [ Transport ] ( examples/sending/transport.ts )
75
111
76
- - [ Advanced] ( examples/sending/everything.ts )
77
- - [ Minimal] ( examples/sending/minimal.ts )
78
- - [ Send email using template] ( examples/sending/template.ts )
79
- - [ Suppressions] ( examples/sending/suppressions.ts )
80
- - [ Nodemailer transport] ( examples/sending/transport.ts )
112
+ ## Examples
81
113
82
- ### Batch Sending API
114
+ Refer to the [ ` examples ` ] ( examples ) folder for the source code of this and other advanced examples.
83
115
84
- - [ Transactional emails] ( examples/batch/transactional.ts )
85
- - [ Bulk emails] ( examples/batch/bulk.ts )
86
- - [ Sandbox emails] ( examples/batch/sandbox.ts )
87
- - [ Emails from template] ( examples/batch/template.ts )
116
+ ### Contacts API
88
117
89
- ### Email testing API
118
+ - [ Contacts ] ( examples/contacts/everything.ts )
90
119
91
- - [ Attachments] ( examples/testing/attachments.ts )
92
- - [ Inboxes] ( examples/testing/inboxes.ts )
93
- - [ Messages] ( examples/testing/messages.ts )
94
- - [ Projects] ( examples/testing/projects.ts )
95
- - [ Send mail using template] ( examples/testing/template.ts )
120
+ ### Contact Lists API
96
121
97
- ### Bulk sending API
122
+ - [ Contact Lists ] ( examples/contact-lists/everything.ts )
98
123
99
- - [ Send mail] ( examples/bulk/send-mail.ts )
100
- - [ Nodemailer Transport] ( examples/bulk/transport.ts )
124
+ ### Sending API
101
125
102
- ### Nodemailer Transport
126
+ - [ Advanced] ( examples/sending/everything.ts )
127
+ - [ Minimal] ( examples/sending/minimal.ts )
128
+ - [ Send email using template] ( examples/sending/template.ts )
129
+ - [ Suppressions management] ( examples/sending/suppressions.ts )
130
+ - [ Nodemailer transport] ( examples/sending/transport.ts )
103
131
104
- > NOTE: [ Nodemailer ] ( https://www.npmjs.com/package/nodemailer ) is needed as a dependency.
132
+ ### Batch Sending API
105
133
106
- ``` sh
107
- yarn add nodemailer
134
+ - [ Transactional emails] ( examples/batch/transactional.ts )
135
+ - [ Bulk emails] ( examples/batch/bulk.ts )
136
+ - [ Sandbox emails] ( examples/batch/sandbox.ts )
137
+ - [ Emails from template] ( examples/batch/template.ts )
108
138
109
- # or, if you are using NPM:
110
- npm install --s nodemailer
111
- ```
139
+ ### Bulk Sending API
112
140
113
- If you're using Typescript, install ` @types/nodemailer ` as a ` devDependency ` .
141
+ - [ Send mail] ( examples/bulk/send-mail.ts )
142
+ - [ Nodemailer Transport] ( examples/bulk/transport.ts )
114
143
115
- ``` sh
116
- yarn add --dev @types/nodemailer
144
+ ### Templates API
117
145
118
- # or, if you are using NPM:
119
- npm install --s-dev @types/nodemailer
146
+ - [ Templates] ( examples/templates/everything.ts )
120
147
121
- You can provide Mailtrap specific keys like ` category ` , ` customVariables ` , ` templateUuid ` and ` templateVariables ` .
148
+ ### Email Sandbox (Testing) API
122
149
123
- ```
124
- See transport usage below:
150
+ - [ Attachments] ( examples/testing/attachments.ts )
151
+ - [ Inboxes] ( examples/testing/inboxes.ts )
152
+ - [ Messages] ( examples/testing/messages.ts )
153
+ - [ Projects] ( examples/testing/projects.ts )
154
+ - [ Send mail using template] ( examples/testing/template.ts )
125
155
126
- - [ Transport] ( examples/sending/transport.ts )
156
+ ### General API
157
+
158
+ - [ List User & Invite account accesses] ( examples/general/account-accesses.ts )
159
+ - [ Remove account access] ( examples/general/accounts.ts )
160
+ - [ Permissions] ( examples/general/permissions.ts )
127
161
128
162
## Development
129
163
@@ -141,9 +175,8 @@ The package is available as open source under the terms of the [MIT License](htt
141
175
142
176
## Code of Conduct
143
177
144
- Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [ code of conduct] ( CODE_OF_CONDUCT.md ) .
178
+ Everyone interacting in the Mailtrap project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [ code of conduct] ( CODE_OF_CONDUCT.md ) .
145
179
146
180
## Compatibility with previous releases
147
181
148
182
Versions of this package up to 2.0.2 were an [ unofficial client] ( https://github.com/vchin/mailtrap-client ) developed by [ @vchin ] ( https://github.com/vchin ) . Package version 3 is a completely new package.
149
-
0 commit comments