diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-06-17 19:04:16 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-06-17 21:37:43 +0800 |
commit | 874c4a8babc5aac7214e71dfef7743bae23893a3 (patch) | |
tree | d7d39313a442bac49859669bb8d1919267575023 /deno/mail-relay/dumb-smtp-server.ts | |
parent | 0824de3bae3550674a9ea029b03c5cb8a35cd8e1 (diff) | |
download | crupest-874c4a8babc5aac7214e71dfef7743bae23893a3.tar.gz crupest-874c4a8babc5aac7214e71dfef7743bae23893a3.tar.bz2 crupest-874c4a8babc5aac7214e71dfef7743bae23893a3.zip |
HALF WORK!:
Diffstat (limited to 'deno/mail-relay/dumb-smtp-server.ts')
-rw-r--r-- | deno/mail-relay/dumb-smtp-server.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/deno/mail-relay/dumb-smtp-server.ts b/deno/mail-relay/dumb-smtp-server.ts index 94502c4..818cc88 100644 --- a/deno/mail-relay/dumb-smtp-server.ts +++ b/deno/mail-relay/dumb-smtp-server.ts @@ -47,7 +47,7 @@ export class DumbSmtpServer { const [decoder, encoder] = [new TextDecoder(), new TextEncoder()]; const decode = (data: Uint8Array) => decoder.decode(data); const send = async (s: string) => { - console.info(LOG_TAG, "Send line: " + s); + console.info(LOG_TAG, "Send line:" + s); await writer.write(encoder.encode(s + CRLF)); }; @@ -70,7 +70,7 @@ export class DumbSmtpServer { buffer = buffer.slice(eolPos + CRLF.length); if (rawMail == null) { - console.info(LOG_TAG, "Received line: " + line); + console.info(LOG_TAG, "Received line:" + line); const upperLine = line.toUpperCase(); if (upperLine.startsWith("EHLO") || upperLine.startsWith("HELO")) { await send(this.#responses["EHLO"]); @@ -86,18 +86,17 @@ export class DumbSmtpServer { await send(this.#responses["QUIT"]); return; } else { - console.warn(LOG_TAG, "Unrecognized command from client: " + line); + console.warn(LOG_TAG, "Unrecognized command from client:" + line); await send(this.#responses["INVALID"]); return; } } else { if (line === ".") { try { - console.info(LOG_TAG, "Mail data Received, begin to relay..."); + console.info(LOG_TAG, "Mail data received, begin to relay..."); const { smtpMessage } = await this.#deliverer.deliverRaw(rawMail); await send(`250 2.6.0 ${smtpMessage}`); rawMail = null; - console.info(LOG_TAG, "Relay succeeded."); } catch (err) { console.error(LOG_TAG, "Relay failed.", err); await send("554 5.3.0 Error: check server log"); @@ -124,7 +123,7 @@ export class DumbSmtpServer { try { await this.#handleConnection(conn); } catch (cause) { - console.error(LOG_TAG, "Tcp connection throws an error.", cause); + console.error(LOG_TAG, "Tcp connection throws an error:", cause); } } } |