{"id":17304988,"url":"https://github.com/lemunozm/mailfred","last_synced_at":"2025-10-04T05:26:20.859Z","repository":{"id":176403616,"uuid":"639640320","full_name":"lemunozm/mailfred","owner":"lemunozm","description":"Expose services through the email infrastructure","archived":false,"fork":false,"pushed_at":"2024-02-13T07:07:08.000Z","size":161,"stargazers_count":31,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-21T13:38:25.198Z","etag":null,"topics":["email","imap","serverless-framework","services","smtp"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lemunozm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-05-11T22:34:21.000Z","updated_at":"2025-02-23T13:34:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"48ccc9c8-3cc3-42de-a782-9f675870bbed","html_url":"https://github.com/lemunozm/mailfred","commit_stats":null,"previous_names":["lemunozm/mailfred"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lemunozm/mailfred","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fmailfred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fmailfred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fmailfred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fmailfred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemunozm","download_url":"https://codeload.github.com/lemunozm/mailfred/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemunozm%2Fmailfred/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277894489,"owners_count":25896022,"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","status":"online","status_checked_at":"2025-10-01T02:00:09.286Z","response_time":88,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["email","imap","serverless-framework","services","smtp"],"created_at":"2024-10-15T11:54:20.183Z","updated_at":"2025-10-04T05:26:20.854Z","avatar_url":"https://github.com/lemunozm.png","language":"Rust","funding_links":["https://www.buymeacoffee.com/lemunozm"],"categories":[],"sub_categories":[],"readme":"![Crates.io](https://img.shields.io/crates/v/mailfred)\n![docs.rs](https://img.shields.io/docsrs/mailfred/latest)\n![Crates.io](https://img.shields.io/crates/l/mailfred)\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/lemunozm/mailfred/ci.yml)\n[![](https://img.shields.io/badge/bymeacoffee-donate-yellow)](https://www.buymeacoffee.com/lemunozm)\n\n\n# Mailfred\n\nExpose services through the email infrastructure processing emails as requests \u0026 responses.\n\n## Motivation\n\nThe simple fact of setting up a custom service to allow users to use it is not easy.\nYou need to deploy your server, pay for resources, host it through a public address,\nand provide a client application that they can use to interact with your service.\n\nThis is a lot of work and maintenance.\nSometimes it can be justified, but sometimes the only purpose is to expose a simple service they can use,\nand you do not want to deal with all this amount of work.\n\n`mailfred` tries to give a solution to this using the current email infrastructure.\nIt reads emails from an email account, fetches them, processes them, and reply them back to the remitter.\nIt does not act as an email server; it acts as a client (using SMTP and IMAP protocols) that connects to an email service provider.\nYou don't need to set up and deploy a server email.\nYou don't need to host anything or buy a public domain address to make it accessible\n(you can run it from your own home if you want).\nAnd more important, all your users already have your client application in their mobiles and computers:\ntheir own email client applications that they already know how to use.\n\n## How does it works?\n`mailfred` is inspired by [`axum`](https://github.com/tokio-rs/axum).\nIt works as an HTTP server, but instead of connecting through a *TCP transport* on *port 80*,\nit is connected through *IMAP and SMTP protocols* on an *email address*.\n\nEach email sent to that email address is fetched and interpreted as if it was an HTTP request.\nThe request email is routed to the correct service using the *subject*.\nOnce it is processed by the service, a new email is sent back to the remitter as if it was an HTTP response.\n\n![image](https://github.com/lemunozm/mailfred/assets/15687891/7366bc2c-6d70-45d8-af3d-20f38edc3696)\n\n## Documentation\n- [API documentation](https://docs.rs/mailfred/)\n- [Architecture diagram](docs/architecture.md)\n- [Examples](examples)\n\n## Getting started\nAdd the following to your `Cargo.toml`:\n```toml\nmailfred = \"0.1\"\ntokio = { version = \"1\", features = [\"full\"] }\n```\n[`tokio`](https://github.com/tokio-rs/tokio) is required to run the async tasks.\n\n## Example \n```rust,no_run\nuse mailfred::{\n    router::{Router, layers::LowercaseHeader},\n    service::{user_error, Request, Response, ResponseResult},\n    transports::Gmail,\n};\nuse tokio::sync::Mutex;\nuse std::sync::Arc;\n\n#[derive(Default)]\nstruct MyState {\n    counter: u32,\n}\n\ntype State = Arc\u003cMutex\u003cMyState\u003e\u003e;\n\nasync fn count(_: Request, state: State) -\u003e ResponseResult {\n    let mut state = state.lock().await;\n    state.counter += 1;\n\n    Response::ok(\"Counter stats\", format!(\"Value: {}\", state.counter))\n}\n\nasync fn echo(req: Request, _: State) -\u003e ResponseResult {\n    Response::ok(req.header, req.body)\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), anyhow::Error\u003e {\n    let gmail = Gmail::new(\"user\", \"1234\");\n\n    let router = Router::default()\n        .route(\"Count\", count)\n        .route(\"Echo\", echo)\n        .layer(LowercaseHeader);\n\n    mailfred::serve(gmail, State::default(), router).await\n}\n```\n\n## Gmail account configuration\nIf you want to use a *Gmail* account, you need to set up some things before:\n1. Create a new account, do NOT use your normal account. The `mailfred`'s *IMAP* transport removes the messages it reads from the inbox.\n2. Enable *IMAP* in the *Gmail* configuration.\n3. Enable [Gmail's app passwords](https://support.google.com/accounts/answer/185833?hl=en) for the account.\n\n## Contribute\n- *Have you implemented a router filter layer or a new transport?*\n  Share it with others! Make a *Pull Request* so everyone can use it :)\n\n- *Do you like the idea and want to contribute? have you found a **bug** or have any **question** or **doubt**?*\n  Do not hesitate and open an issue!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemunozm%2Fmailfred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemunozm%2Fmailfred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemunozm%2Fmailfred/lists"}