diff --git a/client/basic/client.ts b/client/basic/client.ts index 13b283d..5ae4d5c 100644 --- a/client/basic/client.ts +++ b/client/basic/client.ts @@ -151,10 +151,10 @@ export class SMTPClient { writeCMD("MIME-Version: 1.0"); const boundaryAdditionAtt = calcBoundary( - config.mimeContent.map(v => v.content).join("\n") + "\n" - + config.attachments.map(v => v.content).join("\n"), - new RegExp("--attachment([0-9]+)", "g") - ) + config.mimeContent.map((v) => v.content).join("\n") + "\n" + + config.attachments.map((v) => v.content).join("\n"), + new RegExp("--attachment([0-9]+)", "g"), + ); const attachmentBoundary = `attachment${boundaryAdditionAtt}`; @@ -165,9 +165,9 @@ export class SMTPClient { writeCMD(`--${attachmentBoundary}`); const boundaryAdditionMsg = calcBoundary( - config.mimeContent.map(v => v.content).join("\n"), - new RegExp("--message([0-9]+)", "g") - ) + config.mimeContent.map((v) => v.content).join("\n"), + new RegExp("--message([0-9]+)", "g"), + ); const messageBoundary = `message${boundaryAdditionMsg}`; diff --git a/client/basic/encode/attachment.ts b/client/basic/encode/attachment.ts index ff62025..6d6bd17 100644 --- a/client/basic/encode/attachment.ts +++ b/client/basic/encode/attachment.ts @@ -4,11 +4,7 @@ type writer = (...args: string[]) => Promise; export function encodeAttachment(writeCMD: writer, attachment: Attachment) { writeCMD( - `Content-Type: ${ - attachment.contentType - }; name=${ - attachment.filename - }` + `Content-Type: ${attachment.contentType}; name=${attachment.filename}`, ); if (attachment.contentID) { @@ -44,7 +40,7 @@ export function encodeAttachment(writeCMD: writer, attachment: Attachment) { writeCMD("\r\n"); } else if (attachment.encoding === "text") { writeCMD( - "Content-Transfer-Encoding: quoted-printable\r\n" + "Content-Transfer-Encoding: quoted-printable\r\n", ); writeCMD(attachment.content + "\r\n"); diff --git a/client/basic/encode/content.ts b/client/basic/encode/content.ts index fdfc062..bd3ea90 100644 --- a/client/basic/encode/content.ts +++ b/client/basic/encode/content.ts @@ -8,9 +8,7 @@ export function encodeContent(writeCMD: writer, content: Content) { ); if (content.transferEncoding) { writeCMD( - `Content-Transfer-Encoding: ${ - content.transferEncoding - }\r\n`, + `Content-Transfer-Encoding: ${content.transferEncoding}\r\n`, ); } else { // Send new line diff --git a/client/basic/encode/related.ts b/client/basic/encode/related.ts index 4406480..5fe6c0a 100644 --- a/client/basic/encode/related.ts +++ b/client/basic/encode/related.ts @@ -7,13 +7,15 @@ type writer = (...args: string[]) => Promise; export function encodeRelated(writeCMD: writer, content: Content) { if (!content.relatedAttachments) { - throw new Error("Content does not contain relatedAttachments. Cannot encode as related."); + throw new Error( + "Content does not contain relatedAttachments. Cannot encode as related.", + ); } const boundaryAddRel = calcBoundary( - content.content + "\n" - + content.relatedAttachments.map(v => v.content).join("\n"), - new RegExp("--related([0-9]+)", "g") + content.content + "\n" + + content.relatedAttachments.map((v) => v.content).join("\n"), + new RegExp("--related([0-9]+)", "g"), ); const relatedBoundary = `related${boundaryAddRel}`; diff --git a/config/mail/content.ts b/config/mail/content.ts index b3dbe22..2a502f7 100644 --- a/config/mail/content.ts +++ b/config/mail/content.ts @@ -1,4 +1,4 @@ -import { resolveAttachment, Attachment } from "./attachments.ts"; +import { Attachment, resolveAttachment } from "./attachments.ts"; import { quotedPrintableEncode } from "./encoding.ts"; export interface Content { @@ -44,7 +44,9 @@ export function resolveContent({ }; if (relatedAttachments) { - newMime.relatedAttachments = relatedAttachments.map(attachment => resolveAttachment(attachment)) + newMime.relatedAttachments = relatedAttachments.map((attachment) => + resolveAttachment(attachment) + ); } newContent.push(newMime); }