@protobase/server 0.3.2 → 0.3.3
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.
- package/dist/mail/smtp-mailer.js +10 -1
- package/package.json +4 -4
package/dist/mail/smtp-mailer.js
CHANGED
|
@@ -2,16 +2,25 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Plain-text mail over SMTP with Nodemailer: the most used Node SMTP client, maintained, with no dependencies of its
|
|
4
4
|
* own. It is loaded on the first message, so `@protobase/server` itself stays free of Node's network modules.
|
|
5
|
+
*
|
|
6
|
+
* The client greets the server (EHLO) with the sender's domain, the app's own mail name, instead of what the container
|
|
7
|
+
* reports, which is often just `[127.0.0.1]` and makes receiving servers trust the mail less. A `name` query parameter
|
|
8
|
+
* on the SMTP URL still overrides it.
|
|
5
9
|
*/
|
|
6
10
|
const smtpMailer = (settings) => {
|
|
7
11
|
let transport;
|
|
8
12
|
return { send: async (message) => {
|
|
9
|
-
transport ??= import("nodemailer").then(({ createTransport }) => createTransport(
|
|
13
|
+
transport ??= import("nodemailer").then(({ createTransport }) => createTransport({
|
|
14
|
+
url: settings.smtpUrl,
|
|
15
|
+
name: senderDomain(settings.from)
|
|
16
|
+
}));
|
|
10
17
|
await (await transport).sendMail({
|
|
11
18
|
from: settings.from,
|
|
12
19
|
...message
|
|
13
20
|
});
|
|
14
21
|
} };
|
|
15
22
|
};
|
|
23
|
+
/** The domain of a sender address `readMailSettings` accepted, so always a dotted hostname. */
|
|
24
|
+
const senderDomain = (from) => from.slice(from.lastIndexOf("@") + 1);
|
|
16
25
|
//#endregion
|
|
17
26
|
export { smtpMailer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "The Protobase REST API as a Hono app, with Better Auth sign-in.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"kysely": "^0.29.6",
|
|
33
33
|
"nodemailer": "^10.0.16",
|
|
34
34
|
"zod": "^4.6.5",
|
|
35
|
-
"@protobase/
|
|
36
|
-
"@protobase/
|
|
37
|
-
"@protobase/schema": "0.3.
|
|
35
|
+
"@protobase/query": "0.3.3",
|
|
36
|
+
"@protobase/layout": "0.3.3",
|
|
37
|
+
"@protobase/schema": "0.3.3"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsdown"
|