aboutsummaryrefslogtreecommitdiff
path: root/deno/mail-relay
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-06-21 23:00:56 +0800
committerYuqian Yang <crupest@crupest.life>2025-06-21 23:00:56 +0800
commit3f5c388e8bc41b1b6d219743b125ef541efeed96 (patch)
treeb16853c32d2dabfc1af7b1fb04dd019c69e8d680 /deno/mail-relay
parent888650202daeed5c5b423013df9a629d36c3d007 (diff)
downloadcrupest-3f5c388e8bc41b1b6d219743b125ef541efeed96.tar.gz
crupest-3f5c388e8bc41b1b6d219743b125ef541efeed96.tar.bz2
crupest-3f5c388e8bc41b1b6d219743b125ef541efeed96.zip
mail: organize utils in namespace-like object. no logging cause.
Diffstat (limited to 'deno/mail-relay')
-rw-r--r--deno/mail-relay/aws/fetch.ts8
-rw-r--r--deno/mail-relay/mail.ts4
2 files changed, 7 insertions, 5 deletions
diff --git a/deno/mail-relay/aws/fetch.ts b/deno/mail-relay/aws/fetch.ts
index da8609f..34948d4 100644
--- a/deno/mail-relay/aws/fetch.ts
+++ b/deno/mail-relay/aws/fetch.ts
@@ -8,7 +8,7 @@ import {
S3ClientConfig,
} from "@aws-sdk/client-s3";
-import { toFileNameString } from "@crupest/base";
+import { DateUtils } from "@crupest/base";
import { Mail } from "../mail.ts";
@@ -98,7 +98,9 @@ export class AwsMailFetcher {
rawMail = await res.Body.transformToString();
} catch (cause) {
if (cause instanceof NoSuchBucket) {
- console.error(`S3 mail key ${s3Key} not found. Perhaps already consumed?`)
+ console.error(
+ `S3 mail key ${s3Key} not found. Perhaps already consumed?`,
+ );
return;
}
throw cause;
@@ -109,7 +111,7 @@ export class AwsMailFetcher {
const { date } = new Mail(rawMail).parsed;
const dateString = date != null
- ? toFileNameString(date, true)
+ ? DateUtils.toFileNameString(date, true)
: "invalid-date";
const newPath = `${this.#archivePrefix}${dateString}/${s3Key}`;
diff --git a/deno/mail-relay/mail.ts b/deno/mail-relay/mail.ts
index 94944b0..9cc591c 100644
--- a/deno/mail-relay/mail.ts
+++ b/deno/mail-relay/mail.ts
@@ -62,8 +62,8 @@ export class MailDeliverResult {
lines.push(`${prefix} smtpMessage: ${this.smtpMessage}`);
}
for (const [name, result] of this.recipients.entries()) {
- const { kind, message, cause } = result;
- lines.push(`${prefix} (${name}): ${kind} ${message} ${cause}`);
+ const { kind, message } = result;
+ lines.push(`${prefix} (${name}): ${kind} ${message}`);
}
return lines.join("\n");
}