https://github.com/zkemail/relayer-imap
Rust IMAP micro-utility for zk email relayers.
https://github.com/zkemail/relayer-imap
Last synced: 4 months ago
JSON representation
Rust IMAP micro-utility for zk email relayers.
- Host: GitHub
- URL: https://github.com/zkemail/relayer-imap
- Owner: zkemail
- Created: 2024-06-08T17:52:36.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T17:32:29.000Z (over 1 year ago)
- Last Synced: 2025-04-14T18:16:29.645Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IMAP Relayer
This project is an IMAP client that retrieves new emails and forwards them to a specified relayer endpoint.
## Features
- Connects to an IMAP server using either password or OAuth2 authentication
- Retrieves unseen emails from the inbox
- Forwards email bodies to a specified relayer endpoint
- Automatic reconnection on connection loss
## Prerequisites
- Rust (latest stable version)
- Cargo (Rust's package manager)
## Setup
1. Clone the repository:
```
git clone
cd relayer-imap
```
2. Create a `.env` file in the project root and add the following environment variables:
```
RELAYER_ENDPOINT=
IMAP_LOGIN_ID=
IMAP_DOMAIN_NAME=
IMAP_PORT=
AUTH_TYPE=
IMAP_LOGIN_PASSWORD= # If using password authentication
# If using OAuth2 authentication, add these:
IMAP_CLIENT_ID=
IMAP_CLIENT_SECRET=
IMAP_AUTH_URL=
IMAP_TOKEN_URL=
IMAP_REDIRECT_URL=
```
## Usage
To run the project:
```
cargo run
```
This will start the IMAP client, which will continuously check for new emails and forward them to the specified relayer endpoint.
## Configuration
The project uses environment variables for configuration. You can modify these in the `.env` file or set them directly in your environment.
Key configuration options:
- `AUTH_TYPE`: Set to "password" for password-based authentication or "oauth" for OAuth2 authentication.
- `RELAYER_ENDPOINT`: The endpoint where email bodies will be forwarded.
For more details on configuration options, see the `config.rs` file:
```
rust:src/config.rs
startLine: 37
endLine: 57
```
# Error Handling
The project includes robust error handling and automatic reconnection in case of connection issues. If you encounter persistent problems, check the logs for more information.