A lightweight SMTP client/server library for Crystal.
This library aims to provide simple and reliable SMTP functionality with minimal dependencies.
🏗️ Work in Progress
- ✅ SMTP Client - Complete and working
- 🚧 SMTP Server - Planned, not yet implemented
- Add the dependency to your
shard.yml
:
dependencies:
smtp:
github: alefunion/smtp
- Run
shards install
require "smtp"
# Initialize client
client = SMTP::Client.new("email-smtp.us-east-1.amazonaws.com")
begin
# Authenticate
client.authenticate("your_username", "your_password")
# Send email
client.send_email(
from: "[email protected]",
to: "[email protected]",
subject: "Test Email",
body: "Hello from Crystal!"
)
ensure
client.close
end
- TLS support (STARTTLS)
- Authentication (LOGIN method)
- Basic email sending functionality
- Proper SMTP response handling
- Error handling with custom
SMTP::Error
class
- Basic SMTP server implementation
- TLS support
- Authentication handlers
- Message processing hooks
- Custom routing rules