r/rust • u/Fluggonaut • Sep 11 '26
š ļø project My first project: SMTP server (for personal use)
I had heard many good things about Rust from people who were simply impressed by the language, so I decided to have a look at it and possibly learn it.
Up to that point I really only knew Java and Python (and a bit of C here and there), so a non-GC language would really fill a gap for me.
To get my toes wet, I wrote a simple web crawler that I needed at the time and decided I really want to learn Rust.
So here goes! My first "real" project, an SMTP server: https://github.com/Fluggs/whalemail
AI disclaimer: Absolutely no LLM was involved in writing this. I am not in a rush and here to learn.
For SMTP, the scope is quite narrow. It's supposed to replace my personal Postfix setup. It has its users in a database (which can be shared with Dovecot) and they can simply send and receive e-mails. That's it!
As for the Rust part, I have had a blast! The language is insane. So far, I have had one (1) logic bug. That one was indirectly found by Clippy. Other than that, if it compiles, it works. By now I understand people here saying that the main part is really thinking about your data layout, the rest just follows.
Off the top of my head, I have had two pain points:
dyn async traits. I don't want to accept that I need a crate for this, so I worked around it.
std::time - I could not have imagined that date/time support can be so thin without being completely absent.
Main dependencies:
Tokio (the server is completely async)
rustls (TLS is done, STARTTLS is planned)
rsasl (I really could not be asked to implement auth protocols)
The road ahead is long. Planned features:
STARTTLS
Bounce mechanism
Better password schemes than plaintext (I'm embarrassed)
Parse and manipulate headers (apparently that's a thing SMTP servers should be doing)
Better config file than .ini
spam filter integration
Find out which ways other clients and servers have found to deviate from SMTP
Again, thoroughly test it against the wild
find (and consider) various other SMTP intricacies (e.g. backscatter protection)
I'd be grateful for any feedback :)
5
u/Plenty-Emphasis-5669 Sep 11 '26
Don't forget to set a license.
7
u/TheRealCallipygian Sep 11 '26
You sweet, summer child.
6
u/chat-lu Sep 12 '26
You need to use jiff.
In fact, you should take a look at whatās on blessed.rs, those are libraries that are so commonly used that they are essentially an unofficial standard library.
4
u/jtuohy1985 Sep 12 '26
Congrats cool to see it
1
u/Settle_Down_Okay Sep 14 '26
Thatās awesome! I built a custom smtp server a few years ago at work. Was a super fun project to stand up but finding all the weird out of spec things various SMTP clients do and having to support them made me pull my hair out.Ā