From 4b9e766a9a6f7e566991f44b0635bb5db23a0e70 Mon Sep 17 00:00:00 2001 From: mathe42 <2pi_r2@gmx.de> Date: Thu, 9 Jun 2022 14:30:05 +0200 Subject: [PATCH 1/2] feat: content-id for attachment --- client/basic/client.ts | 6 ++++++ config/mail/attachments.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/client/basic/client.ts b/client/basic/client.ts index b7d8773..6d088e4 100644 --- a/client/basic/client.ts +++ b/client/basic/client.ts @@ -258,6 +258,12 @@ export class SMTPClient { "name=" + attachment.filename, ); + if(attachment.contentID) { + await this.#connection.writeCmd( + `Content-ID: <${attachment.contentID}>`, + ); + } + await this.#connection.writeCmd( "Content-Disposition: attachment; filename=" + attachment.filename, "\r\n", diff --git a/config/mail/attachments.ts b/config/mail/attachments.ts index 3fd43fa..86a5d83 100644 --- a/config/mail/attachments.ts +++ b/config/mail/attachments.ts @@ -3,6 +3,7 @@ import { base64Decode } from "./encoding.ts"; interface baseAttachment { contentType: string; filename: string; + contentID?: string | number } export type Attachment = From 24a6c1eead29aaf18461407bfaf50e83a50a2c14 Mon Sep 17 00:00:00 2001 From: mathe42 <2pi_r2@gmx.de> Date: Thu, 9 Jun 2022 14:31:22 +0200 Subject: [PATCH 2/2] format files --- client/basic/client.ts | 2 +- config/mail/attachments.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/basic/client.ts b/client/basic/client.ts index 6d088e4..1b6cb50 100644 --- a/client/basic/client.ts +++ b/client/basic/client.ts @@ -258,7 +258,7 @@ export class SMTPClient { "name=" + attachment.filename, ); - if(attachment.contentID) { + if (attachment.contentID) { await this.#connection.writeCmd( `Content-ID: <${attachment.contentID}>`, ); diff --git a/config/mail/attachments.ts b/config/mail/attachments.ts index 86a5d83..cd801bf 100644 --- a/config/mail/attachments.ts +++ b/config/mail/attachments.ts @@ -3,7 +3,7 @@ import { base64Decode } from "./encoding.ts"; interface baseAttachment { contentType: string; filename: string; - contentID?: string | number + contentID?: string | number; } export type Attachment =