state_dir /dev/shm/maddy/state
runtime_dir /dev/shm/maddy/run

openmetrics tcp://0.0.0.0:9749 { }

smtp tcp://0.0.0.0:2525 {
    debug {env:DEBUG}
    io_debug {env:DEBUG}

    source {env:SMTP_DOMAIN} {
        deliver_to &remote_queue
    }

    default_source {
        reject
    }
}

target.queue remote_queue {
    debug {env:DEBUG}
    target &remote_smtp
}

target.smtp remote_smtp {
    debug {env:DEBUG}
    attempt_starttls yes
    require_tls yes
    auth plain {env:SMTP_USERNAME} {env:SMTP_PASSWORD}
    targets tls://{env:SMTP_SERVER}:{env:SMTP_PORT}
}
