Skip to content

Commit 8a8c824

Browse files
committed
feat: A barebones SMTP server
This commit starts the fastn-mail crate. This will handle the SMTP/IMAP and related email protcols. It'll also contain the bridge code so that email clients can talk to this but the email get delivered over the iroh network. A simple SMTP impl is done, a lot of the things are left: - support full SMTP proto - upgrade to encrypted connection STARTTLS. Some client might depend on this. - Actually deliver emails - IMAP impl so that clients can fetch emails The current impl is able to handle the tests/send-mail.py script. This was just an experimentation to learn basics of SMTP protcol.
1 parent 03fdbfe commit 8a8c824

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

v0.5/Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v0.5/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ ed25519-dalek = { version = "2.1.1", features = ["rand_core"] }
8686
data-encoding = "2"
8787
eyre = "0.6"
8888
ft-sys-shared = { version = "0.2.1", features = ["rusqlite", "host-only"] }
89+
futures = "0.3"
8990
futures-util = { version = "0.3", default-features = false, features = ["std"] }
9091
http = "1"
9192
http-body-util = "0.1"
@@ -102,6 +103,7 @@ magic-crypt = { version = "4", default-features = false }
102103
once_cell = "1"
103104
rand = "0.8.5"
104105
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
106+
regex = "1"
105107
scc = "2"
106108
serde = { version = "1", features = ["derive"] }
107109
serde_json = "1"

v0.5/fastn-mail/Cargo.toml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ authors.workspace = true
66
license.workspace = true
77
repository.workspace = true
88
homepage.workspace = true
9+
description = "SMTP and IMAP implementation for fastn p2p email"
910

1011
[[bin]]
1112
name = "fastn-mail"
@@ -16,26 +17,23 @@ required-features = ["cli"]
1617
cli = ["clap", "tracing-subscriber"]
1718

1819
[dependencies]
19-
# Core dependencies
20-
fastn-automerge.workspace = true
21-
autosurgeon.workspace = true
2220
automerge.workspace = true
21+
autosurgeon.workspace = true
22+
chrono.workspace = true
23+
eyre.workspace = true
24+
fastn-automerge.workspace = true
2325
fastn-id52 = { workspace = true, features = ["automerge"] }
26+
futures.workspace = true
27+
regex.workspace = true
28+
rusqlite.workspace = true
2429
serde.workspace = true
2530
serde_json.workspace = true
2631
thiserror.workspace = true
27-
tracing.workspace = true
32+
tokio-util.workspace = true
2833
tokio.workspace = true
29-
30-
# For database storage
31-
rusqlite.workspace = true
32-
33-
# For timestamps
34-
chrono.workspace = true
35-
36-
# For email parsing
34+
tracing.workspace = true
3735
mail-parser = "0.9"
3836

3937
# CLI dependencies (optional)
4038
clap = { workspace = true, optional = true }
41-
tracing-subscriber = { workspace = true, optional = true }
39+
tracing-subscriber = { workspace = true, optional = true }

v0.5/fastn-mail/tests/send-mail.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import smtplib
2+
3+
server = smtplib.SMTP('127.0.0.1', 9090)
4+
server.sendmail('siddhant@localhost', 'amitu@localhost', 'This is a test email')
5+
server.quit()

0 commit comments

Comments
 (0)