summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-09 01:34:07 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-09 01:34:07 +0900
commitb323ad4824cc62cf54a9bfa4f9f68dda4b783323 (patch)
treeae574fe0cfb2a7e3628d5a3f5c30443940e2ed0a
parentf9cc6d3f2dc884739ea640ef54adaeb35d117220 (diff)
Use Postfix container for recap mail; add Message-ID header
Port 25 outbound unblocked: send-recap.ts now routes through the mail container (Postfix + OpenDKIM) for direct MX delivery with DKIM signing. Removes inline MX lookup logic added in the previous workaround. Also adds Message-ID header (required by Gmail) and updates default RECAP_TO to mazideyabai@gmail.com. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--scripts/send-recap.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/send-recap.ts b/scripts/send-recap.ts
index da98b6f..3dcdd08 100644
--- a/scripts/send-recap.ts
+++ b/scripts/send-recap.ts
@@ -2,13 +2,13 @@
/**
* Daily live event recap mailer.
* Queries today's events (JST) from SQLite and sends an HTML digest via the
- * internal Postfix container (mail:25 on the web Docker network).
+ * mail container (Postfix + OpenDKIM) which delivers directly to recipient MX.
*
* Env vars:
* DB_PATH path to SQLite database (default: /app/data/events.db)
- * MAIL_HOST SMTP relay hostname (default: mail)
+ * MAIL_HOST SMTP host (default: mail — the Postfix container)
* MAIL_PORT SMTP port (default: 25)
- * RECAP_TO recipient address (default: efemeraladdress+golive@gmail.com)
+ * RECAP_TO recipient address (default: mazideyabai@gmail.com)
*/
import Database from "better-sqlite3";
@@ -18,7 +18,8 @@ const DB_PATH = process.env.DB_PATH ?? "/app/data/events.db";
const MAIL_HOST = process.env.MAIL_HOST ?? "mail";
const MAIL_PORT = parseInt(process.env.MAIL_PORT ?? "25", 10);
const FROM = "noreply@golive.yyamashita.com";
-const TO = process.env.RECAP_TO ?? "efemeraladdress+golive@gmail.com";
+const EHLO_DOMAIN = "golive.yyamashita.com";
+const TO = process.env.RECAP_TO ?? "mazideyabai@gmail.com";
const APP_URL = "https://golive.yyamashita.com";
// ---- date helpers (JST = UTC+9) ----------------------------------------
@@ -144,9 +145,11 @@ function foldBase64(b64: string): string {
function buildMessage(subject: string, html: string): string {
const date = new Date().toUTCString();
+ const msgId = `<${Date.now()}.recap@${EHLO_DOMAIN}>`;
const b64body = foldBase64(Buffer.from(html).toString("base64"));
return [
`Date: ${date}`,
+ `Message-ID: ${msgId}`,
`From: Tokyo Livehouse Events <${FROM}>`,
`To: ${TO}`,
`Subject: ${encodeSubject(subject)}`,
@@ -178,7 +181,7 @@ function smtpSend(
phase++;
switch (phase) {
case 1:
- socket.write("EHLO recap\r\n");
+ socket.write(`EHLO ${EHLO_DOMAIN}\r\n`);
break;
case 2:
socket.write(`MAIL FROM:<${from}>\r\n`);