@tylix/mail 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/package.json +26 -7
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mbiyrukzz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @tylix/mail
2
+
3
+ Email for Tylix apps: Mailables, an SMTP driver with STARTTLS, a log
4
+ driver for development, and a log of what was sent.
5
+
6
+ ```sh
7
+ npm install @tylix/mail
8
+ ```
9
+
10
+ ## Sending
11
+
12
+ ```js
13
+ import { Mail } from '@tylix/mail'
14
+
15
+ await Mail.send(
16
+ { to: 'ada@example.com', subject: 'Welcome', view: 'welcome', data: { name: 'Ada' } },
17
+ config.mail,
18
+ )
19
+ ```
20
+
21
+ `view` names an HTML file in `resources/mail/`; `{{ name }}` placeholders
22
+ are filled from `data`.
23
+
24
+ ## Mailables
25
+
26
+ ```js
27
+ import { Mailable } from '@tylix/mail'
28
+
29
+ export class WelcomeMail extends Mailable {
30
+ constructor(user) {
31
+ super()
32
+ this.user = user
33
+ }
34
+ build() {
35
+ return { subject: 'Welcome', view: 'welcome', data: { name: this.user.name } }
36
+ }
37
+ }
38
+
39
+ await new WelcomeMail(user).send(user.email, config.mail)
40
+ ```
41
+
42
+ `tylix make:mail Welcome` creates one.
43
+
44
+ ## Drivers
45
+
46
+ Set `MAIL_DRIVER` in `.env`:
47
+
48
+ - `smtp`: sends through `MAIL_HOST`, `MAIL_PORT`, `MAIL_USER`, `MAIL_PASSWORD`
49
+ (`MAIL_SECURE=true` for port 465; port 587 upgrades with STARTTLS)
50
+ - `log` (default): records mail instead of sending it. In development the
51
+ starter shows them at `/dev/mail`, so verification and reset links work
52
+ without a mail server.
53
+
54
+ Every mail is recorded in the `mail_logs` table (`MailLog`).
55
+
56
+ ## License
57
+
58
+ MIT
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@tylix/mail",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Mail system for Tylix: Mailables, SMTP and log drivers, and mail logging",
5
+ "license": "MIT",
6
+ "author": "Mbiyrukzz",
5
7
  "type": "module",
6
8
  "keywords": [
7
9
  "tylix",
@@ -9,6 +11,18 @@
9
11
  "email",
10
12
  "smtp"
11
13
  ],
14
+ "homepage": "https://github.com/Mbiyrukzz/tylix/tree/main/packages/mail#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Mbiyrukzz/tylix.git",
18
+ "directory": "packages/mail"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/Mbiyrukzz/tylix/issues"
22
+ },
23
+ "engines": {
24
+ "node": ">=22.13"
25
+ },
12
26
  "main": "index.js",
13
27
  "types": "index.d.ts",
14
28
  "exports": {
@@ -25,15 +39,20 @@
25
39
  "Mailable.js",
26
40
  "models",
27
41
  "drivers",
28
- "SmtpClient.js"
42
+ "SmtpClient.js",
43
+ "!**/*.test.js",
44
+ "!**/*.test.mjs",
45
+ "README.md",
46
+ "LICENSE"
29
47
  ],
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
30
51
  "dependencies": {
31
- "@tylix/shared": "^0.5.1"
52
+ "@tylix/shared": "^0.7.0",
53
+ "@tylix/generator": "^0.7.0"
32
54
  },
33
55
  "peerDependencies": {
34
- "@tylix/orm": "^0.5.1"
35
- },
36
- "publishConfig": {
37
- "access": "public"
56
+ "@tylix/orm": "^0.7.0"
38
57
  }
39
58
  }