This repository has been archived by the owner on Jul 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue with port 25 already in use error
- Loading branch information
1 parent
4f2b88f
commit 25fc5d8
Showing
2 changed files
with
23 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// mail server | ||
import { SMTPServer } from "smtp-server"; | ||
import { simpleParser } from "mailparser"; | ||
import { util } from "../util"; | ||
import fs from "fs"; | ||
import config from "../config.json"; | ||
import { mailbox } from "./mailbox" | ||
const server: SMTPServer = new SMTPServer({ | ||
onData(stream, session, callback) { | ||
simpleParser(stream, {}, (e, p) => { | ||
if (e) return util.mailLog(`err: ${e}`); | ||
return mailbox.receiveMail(p, session, callback); | ||
}) | ||
}, | ||
disabledCommands: ["AUTH"] | ||
}); | ||
|
||
// server.listen keeps crashing with my firewall saying I cant run port 25, if you're facing the same issue, comment out server.listen | ||
|
||
server.listen(config.mail.port, "0.0.0.0", () => util.mailLog("server started")); |