https://github.com/zkemail/relayer-smtp
Rust SMTP micro-utility for zk email relayers.
https://github.com/zkemail/relayer-smtp
Last synced: 4 months ago
JSON representation
Rust SMTP micro-utility for zk email relayers.
- Host: GitHub
- URL: https://github.com/zkemail/relayer-smtp
- Owner: zkemail
- Created: 2024-06-08T16:17:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-15T17:33:02.000Z (over 1 year ago)
- Last Synced: 2025-07-08T20:48:04.270Z (11 months ago)
- Language: Rust
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Relayer SMTP
Relayer SMTP is a simple email relay server built with Rust, Actix Web, and Tokio. It provides an HTTP API for sending emails through a configured SMTP server.
## Features
- HTTP API for sending emails
- Configurable SMTP and server settings via environment variables
- Asynchronous email sending using Tokio
- Simple health check endpoint
## Project Structure
- `src/main.rs`: Entry point of the application
- `src/config.rs`: Configuration structures and loading
- `src/server.rs`: HTTP server implementation
- `src/smtp_client.rs`: SMTP client implementation
- `src/lib.rs`: Library functions and module declarations
- `src/strings.rs`: Constant strings used in the project
## Setup
1. Clone the repository
2. Copy `.env.example` to `.env` and fill in the required environment variables:
```
SMTP_DOMAIN_NAME=your_smtp_domain
SMTP_LOGIN_ID=your_smtp_login
SMTP_LOGIN_PASSWORD=your_smtp_password
MESSAGE_ID_DOMAIN=your_message_id_domain
SERVER_HOST=localhost
SERVER_PORT=8080
```
3. Run `cargo build` to compile the project
## Usage
1. Start the server:
```
cargo run
```
2. The server will start on the configured host and port (default: `localhost:8080`)
## API Endpoints
### GET /api/ping
Health check endpoint.
**Response:**
```
Hello, world!
```
### POST /api/sendEmail
Send an email using the SMTP relay service.
**Sample Body:**
```bash
curl -X POST http://localhost:3000/api/sendEmail \
-H "Content-Type: application/json" \
-d '{
"to": "recipient@example.com",
"subject": "Test Email",
"body_plain": "This is a test email.",
"body_html": "
This is a test email.
",
"reference": null,
"reply_to": null,
"body_attachments": null
}'
```
**Success Response:**
```json
{
"message_id": "",
"status": "success"
}
```