# Email Feature Configuration
# Settings for the email sending system with multiple providers

[features]
email = true

# Email Configuration
[email]
enabled = true
from_email = "noreply@yourapp.com"
from_name = "Rustelo App"
reply_to = ""
default_provider = "console"  # "smtp", "sendgrid", "console"

# SMTP Configuration
[email.smtp]
host = "smtp.gmail.com"
port = 587
username = "your-email@gmail.com"
password = "your-app-password"
use_tls = true
use_starttls = true
timeout = 30
pool_size = 5

# SendGrid Configuration
[email.sendgrid]
api_key = "your-sendgrid-api-key"
endpoint = "https://api.sendgrid.com/v3/mail/send"
timeout = 30

# Console Provider (Development)
[email.console]
enabled = true
log_level = "info"
save_to_file = true
output_dir = "logs/emails"

# Email Templates
[email.templates]
template_dir = "templates/email"
default_language = "en"
supported_languages = ["en", "es", "fr", "de"]
cache_templates = true
reload_on_change = false  # Set to true in development

# Template Configuration
[email.templates.welcome]
subject = "Welcome to {{app_name}}"
template = "welcome.hbs"
text_template = "welcome.txt"

[email.templates.password_reset]
subject = "Password Reset Request"
template = "password_reset.hbs"
text_template = "password_reset.txt"
expiration = 3600  # 1 hour

[email.templates.email_verification]
subject = "Verify Your Email Address"
template = "email_verification.hbs"
text_template = "email_verification.txt"
expiration = 86400  # 24 hours

[email.templates.two_factor]
subject = "Two-Factor Authentication Code"
template = "two_factor.hbs"
text_template = "two_factor.txt"
expiration = 300  # 5 minutes

# Email Queue Configuration
[email.queue]
enabled = true
max_retry_attempts = 3
retry_delay = 60  # seconds
batch_size = 10
processing_interval = 30  # seconds

# Rate Limiting
[email.rate_limiting]
max_emails_per_minute = 60
max_emails_per_hour = 1000
max_emails_per_day = 10000
burst_limit = 10

# Email Validation
[email.validation]
check_mx_records = true
check_disposable_domains = true
allowed_domains = []  # Empty means all domains allowed
blocked_domains = ["tempmail.org", "10minutemail.com"]

# Bounce Handling
[email.bounce_handling]
enabled = true
webhook_url = "/webhooks/email/bounce"
webhook_secret = "your-webhook-secret"
max_bounce_rate = 0.05  # 5%
auto_suppress_bounces = true

# Email Analytics
[email.analytics]
track_opens = false
track_clicks = false
track_deliveries = true
track_bounces = true
track_complaints = true

# Security Settings
[email.security]
enable_dkim = false
dkim_selector = "default"
dkim_private_key_path = "certs/dkim_private.key"
enable_spf = true
enable_dmarc = false

# Internationalization
[email.i18n]
auto_detect_language = true
fallback_language = "en"
timezone = "UTC"
date_format = "%Y-%m-%d %H:%M:%S"

# Development Settings
[email.development]
intercept_emails = false
intercept_to = "developer@localhost"
log_all_emails = true
fake_send = false
