@upyo/smtp 0.2.1-dev.28 → 0.2.1-dev.29

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/index.cjs CHANGED
@@ -23,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  const node_net = __toESM(require("node:net"));
25
25
  const node_tls = __toESM(require("node:tls"));
26
- const __upyo_core = __toESM(require("@upyo/core"));
27
26
  const node_buffer = __toESM(require("node:buffer"));
28
27
 
29
28
  //#region src/config.ts
@@ -279,10 +278,10 @@ async function buildRawMessage(message) {
279
278
  const hasHtml = "html" in message.content;
280
279
  const hasText = "text" in message.content;
281
280
  const isMultipart = hasAttachments || hasHtml && hasText;
282
- lines.push(`From: ${encodeHeaderValue((0, __upyo_core.formatAddress)(message.sender))}`);
283
- lines.push(`To: ${encodeHeaderValue(message.recipients.map(__upyo_core.formatAddress).join(", "))}`);
284
- if (message.ccRecipients.length > 0) lines.push(`Cc: ${encodeHeaderValue(message.ccRecipients.map(__upyo_core.formatAddress).join(", "))}`);
285
- if (message.replyRecipients.length > 0) lines.push(`Reply-To: ${encodeHeaderValue(message.replyRecipients.map(__upyo_core.formatAddress).join(", "))}`);
281
+ lines.push(`From: ${encodeAddress(message.sender)}`);
282
+ lines.push(`To: ${message.recipients.map(encodeAddress).join(", ")}`);
283
+ if (message.ccRecipients.length > 0) lines.push(`Cc: ${message.ccRecipients.map(encodeAddress).join(", ")}`);
284
+ if (message.replyRecipients.length > 0) lines.push(`Reply-To: ${message.replyRecipients.map(encodeAddress).join(", ")}`);
286
285
  lines.push(`Subject: ${encodeHeaderValue(message.subject)}`);
287
286
  lines.push(`Date: ${(/* @__PURE__ */ new Date()).toUTCString()}`);
288
287
  lines.push(`Message-ID: <${generateMessageId()}>`);
@@ -362,6 +361,11 @@ function generateMessageId() {
362
361
  const random = Math.random().toString(36).substr(2, 9);
363
362
  return `${timestamp}.${random}@upyo.local`;
364
363
  }
364
+ function encodeAddress(address) {
365
+ if (address.name == null) return address.address;
366
+ const encodedDisplayName = encodeHeaderValue(address.name);
367
+ return `${encodedDisplayName} <${address.address}>`;
368
+ }
365
369
  function encodeHeaderValue(value) {
366
370
  if (!/^[\x20-\x7E]*$/.test(value)) {
367
371
  const utf8Bytes = new TextEncoder().encode(value);
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Socket } from "node:net";
2
2
  import { connect } from "node:tls";
3
- import { formatAddress } from "@upyo/core";
4
3
  import { Buffer } from "node:buffer";
5
4
 
6
5
  //#region src/config.ts
@@ -256,10 +255,10 @@ async function buildRawMessage(message) {
256
255
  const hasHtml = "html" in message.content;
257
256
  const hasText = "text" in message.content;
258
257
  const isMultipart = hasAttachments || hasHtml && hasText;
259
- lines.push(`From: ${encodeHeaderValue(formatAddress(message.sender))}`);
260
- lines.push(`To: ${encodeHeaderValue(message.recipients.map(formatAddress).join(", "))}`);
261
- if (message.ccRecipients.length > 0) lines.push(`Cc: ${encodeHeaderValue(message.ccRecipients.map(formatAddress).join(", "))}`);
262
- if (message.replyRecipients.length > 0) lines.push(`Reply-To: ${encodeHeaderValue(message.replyRecipients.map(formatAddress).join(", "))}`);
258
+ lines.push(`From: ${encodeAddress(message.sender)}`);
259
+ lines.push(`To: ${message.recipients.map(encodeAddress).join(", ")}`);
260
+ if (message.ccRecipients.length > 0) lines.push(`Cc: ${message.ccRecipients.map(encodeAddress).join(", ")}`);
261
+ if (message.replyRecipients.length > 0) lines.push(`Reply-To: ${message.replyRecipients.map(encodeAddress).join(", ")}`);
263
262
  lines.push(`Subject: ${encodeHeaderValue(message.subject)}`);
264
263
  lines.push(`Date: ${(/* @__PURE__ */ new Date()).toUTCString()}`);
265
264
  lines.push(`Message-ID: <${generateMessageId()}>`);
@@ -339,6 +338,11 @@ function generateMessageId() {
339
338
  const random = Math.random().toString(36).substr(2, 9);
340
339
  return `${timestamp}.${random}@upyo.local`;
341
340
  }
341
+ function encodeAddress(address) {
342
+ if (address.name == null) return address.address;
343
+ const encodedDisplayName = encodeHeaderValue(address.name);
344
+ return `${encodedDisplayName} <${address.address}>`;
345
+ }
342
346
  function encodeHeaderValue(value) {
343
347
  if (!/^[\x20-\x7E]*$/.test(value)) {
344
348
  const utf8Bytes = new TextEncoder().encode(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@upyo/smtp",
3
- "version": "0.2.1-dev.28+d9e603b0",
3
+ "version": "0.2.1-dev.29+e2006b62",
4
4
  "description": "SMTP transport for Upyo email library",
5
5
  "keywords": [
6
6
  "email",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "sideEffects": false,
55
55
  "peerDependencies": {
56
- "@upyo/core": "0.2.1-dev.28+d9e603b0"
56
+ "@upyo/core": "0.2.1-dev.29+e2006b62"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@dotenvx/dotenvx": "^1.47.3",