aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Add queue for mail processingHEADmasterMroik2026-05-09
| | | | | | | Add DB table for queue. It is necessary in case the delivery fails and we'll need to retry. Signed-off-by: Mroik <mroik@delayed.space>
* Fix last touchups on SmtpServer and add testMroik2026-04-15
| | | | | | | | | Fix some mistakes in the SmtpServer implementation and add test. This test is only for the ideal interaction, it doesn't cover all checks for the malformed or out of order commands. This is left for later. Signed-off-by: Mroik <mroik@delayed.space>
* Remove extra String alloc improving memory usageMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Move logging for premature TCP terminationMroik2026-04-13
| | | | | | | | | | It logs anytime we break out of the loop, therefore logging a connection closed by remote regardless of what happened. Move logging to closed connection check and make it a warn instead of an info. Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP QUIT commandMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Fix reply messagesMroik2026-04-13
| | | | | | The replies do not end with <CRLF>. Fix it. Signed-off-by: Mroik <mroik@delayed.space>
* Add a note on email encodingsMroik2026-04-13
| | | | | | | | | | | | | Leave a note for future devs that the server might receive an email with an encoding different from ASCII or UTF-8. This can be problematic as String accepts only UTF-8 valid strings. In TODO when I say "handle non UTF-8 encodings", I think it would be totally ok to just disregard anything that isn't UTF-8 and return a "rejected for policy" error to the MTA. Otherwise we'll just have to put `encoding_rs` in the mix. Signed-off-by: Mroik <mroik@delayed.space>
* Replace std socket IO with tokio socket IOMroik2026-04-13
| | | | | | | | | | | Since the TcpListener (and related) operations are blocking, they would prevent other tasks from running by monopolizing CPU time. This should've been done from the start but I'm not used to directly using low level primitives in an async environment as I would normally use a high level library for this, so I forgot. Signed-off-by: Mroik <mroik@delayed.space>
* Do not propagate TcpListener.accept() errorsMroik2026-04-13
| | | | | | | | | | | | Errors produced by the socket may not be necessarily fatal, meaning that while a connection might be dropped the process should be able to resume execution as if nothing happened and accept the next connection. Error handling for accept() has been copied from NGINX's [1]. [1] https://stackoverflow.com/questions/76955978/which-socket-accept-errors-are-fatal Signed-off-by: Mroik <mroik@delayed.space>
* Add mail processing scaffoldingMroik2026-04-13
| | | | | | | | | | After receiving the email we don't want to process it in the same thread as soon as we can, instead we queue it to a MailProcessor. This allows us to be more flexible with the pipeline and reduce the amount of concurrency for the database connection. This also helps with writing possible fences around resource consumption. Signed-off-by: Mroik <mroik@delayed.space>
* Rename modules to more accurate namesMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Fix some clippy stuffMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP DATA command for mail inputMroik2026-04-13
| | | | | | | Forwarding and storing are yet to be implemented, but this commit does implement the handling of the DATA command. Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP recipient commandMroik2026-04-13
| | | | | | | | | | Validation for the recipients' email addresses should be added later on. This is not strictly necessary as the request at this point will already have gone through another MTA, but it should be done just for good measure in case someone decides to expose this software directly to the internet. Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP start mail transactionMroik2026-04-13
| | | | | | | | | Validation for the sender's email address should be added later on. This is not strictly necessary as the request at this point will already have gone through another MTA, but it should be done just for good measure in case someone decides to expose this software directly to the internet. Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP reply for unrecognized commandsMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP server greetingMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Implement HELO command interactionMroik2026-04-13
| | | | | | | | EHLO most likely won't be implemented as this software is meant to be ran in a containerized environment, where only the main MTA is supposed to be able to reach the container of this software. Signed-off-by: Mroik <mroik@delayed.space>
* Add SMTP server scaffoldingMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Rename stuff to disambiguateMroik2026-04-13
| | | | | | | Having both the callback and the high level API be called execute() is confusing. Rename for clarity. Signed-off-by: Mroik <mroik@delayed.space>
* Refactor to avoid double checks on typesMroik2026-04-13
| | | | | | | | | | | | The various Query enums limit themselves to checking which variant they are before choosing a which function to call to process the request. Because they are enums with multiple variants, to unpack we have to check again which variant they are. Unpack before the call and modify function signatures to receive the already unpacked values. Signed-off-by: Mroik <mroik@delayed.space>
* list.rs: refactor tests for readabilityMroik2026-04-13
| | | | Signed-off-by: Mroik <mroik@delayed.space>
* Add subscription table interactionMroik2026-04-13
| | | | | | | | | | We need to track which user subscribed to which list. Unlike User and List, we don't need to make a Subscription model, this is because this is a relationship and not an entity of its own. Implement database interaction with subscription. Signed-off-by: Mroik <mroik@delayed.space>
* Add List modelMroik2026-04-13
| | | | | | | | | | We ideally want to be able to handle multiple mailing lists without having to run a new instance for each one. To do this we need to be able to create new lists. Add List model with its DB interactions. Signed-off-by: Mroik <mroik@delayed.space>
* Implement User modelMroik2026-04-13
| | | | | | | | | The mailing list will need to save the data of the subscribers for them to receive the emails. Add User model with its DB interactions. Signed-off-by: Mroik <mroik@delayed.space>
* Add scaffolding for DB interactionsMroik2026-04-13
| | | | | | | | | The mailing list will need to save various data to operate for things such as the subscriber's email. Add database interaction machanism. Signed-off-by: Mroik <mroik@delayed.space>
* Initial commitMroik2026-04-13
A mailing list implementation by POuL for POuL that aims to be minimal but use SMTP to deliver receiving emails instead of LMTP. This is because mailing list software that use LMTP as their delivery mechanism make achieving modularized container environments harder. This is due to the fact that mailing lists that use LMTP require it and the main MTA to live on the same machine. This implementation aims to be good enough to be used as the mailing list for POuL in its kubernetes infrastructure (and frankly, it was about time that someone implemented a mailing list that could be "standalone" in containers). Signed-off-by: Mroik <mroik@delayed.space>
XMR address: 854DmXNrxULU3ZFJVs4Wc8PFhbq29RhqHhY8W6cdWrtFN3qmooKyyeYPcDzZTNRxphhJ5UzASQfAdEMwSteVqymk28aLhqj