{"id":21247694,"url":"https://github.com/jasterv/rust-mailing-poc","last_synced_at":"2025-06-11T14:06:09.615Z","repository":{"id":148760390,"uuid":"618605983","full_name":"JasterV/rust-mailing-poc","owner":"JasterV","description":"Just a POC to try out both SMTP and IMAP rust clients.","archived":false,"fork":false,"pushed_at":"2023-04-01T23:56:49.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-07T21:32:57.559Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JasterV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-24T21:02:35.000Z","updated_at":"2023-03-26T02:08:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"f81b9ec4-6693-4293-a9e4-08c42150c95f","html_url":"https://github.com/JasterV/rust-mailing-poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Frust-mailing-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Frust-mailing-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Frust-mailing-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Frust-mailing-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JasterV","download_url":"https://codeload.github.com/JasterV/rust-mailing-poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685587,"owners_count":20330983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T02:42:26.190Z","updated_at":"2025-03-15T05:15:46.668Z","avatar_url":"https://github.com/JasterV.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-mailing-poc\n\nJust a POC of both SMTP and IMAP rust crates.\n\n## SMTP Client\n\nWe are using [Lettre](https://github.com/lettre/lettre) crate for SMTP.\n\n## IMAP client\n\nWe use [async-imap](https://github.com/async-email/async-imap) crate to communicate with an IMAP server.\n\n## IMAP/SMTP server\n\nWe are using [Greenmail](https://greenmail-mail-test.github.io/greenmail/).\nThey have a public docker image we can use to run an email server locally that supports both SMTP and IMAP protocols.\n\n## IMAP connection pool\n\nI've implemented a connection pool manager for IMAP sessions using the [deadpool](https://github.com/bikeshedder/deadpool) crate.\n\nThe reason for doing this is that an IMAP session only allows to execute 1 command at a time, and 1 connection only can have 1 session, so in this case connection = session. \n\nIf we want to be able to execute multiple IMAP commands at once, we need to use a connection pool, so we can create and reuse connections once they are available.\n\n## Try out\n\nCopy the `.env.example` file to a `.env` file \n\n```\ncp .env.example .env\n```\n\nBuild the images \n\n```\nmake build\n```\n\nRun the compose \n\n```\nmake up\n```\n\nMake the sender post a dummy message \n\n```\ncurl --header \"Content-Type: application/json\" --data '{\"subject\": \"Dummy email\", body: \"This is the body of the email\"}' http://localhost:\u003cPORT\u003e/send\n```\n\nCall the receiver to fetch all the messages on the inbox\n\n```\ncurl -X GET http://localhost:$(PORT)/inbox\n```\n\nSet new flags to messages using their UIDs\n\n```\ncurl --header \"Content-Type: application/json\" --data '{\"uids\": [1, 2], \"flags\": [\"Draft\", {\"custom\": \"MyCustomFlag\"}]}' http://localhost:\u003cPORT\u003e/inbox/flags\n```\n\nStop the containers \n\n```\nmake down\n```\n\nor `\u003cCtrl-C\u003e`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasterv%2Frust-mailing-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasterv%2Frust-mailing-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasterv%2Frust-mailing-poc/lists"}