Files

Cloud Mail Worker

This Worker receives every address at yyggslive.cc.cd, stores messages in D1, and exposes the API expected by this repository's cloudmail provider.

Deploy

  1. Install Node.js 20+ and authenticate:

    npm install
    npx wrangler login
    
  2. Create the D1 database and copy the returned database_id into wrangler.toml:

    npm run db:create
    npm run db:migrate
    
  3. Generate a long random API token and store it as a Worker secret:

    npx wrangler secret put API_TOKEN
    npm run deploy
    
  4. In the Cloudflare dashboard, enable Email Routing for yyggslive.cc.cd. Add an Email Worker route for *@yyggslive.cc.cd that targets this Worker. Cloudflare will show the MX records that must be present in DNS.

  5. Put the deployed Worker URL and the token in the root config.json:

    {
      "email_provider": "cloudmail",
      "cloudmail_api_base": "https://cloudmail-inbox.<your-subdomain>.workers.dev",
      "cloudmail_public_token": "the API_TOKEN value",
      "cloudmail_domains": "yyggslive.cc.cd",
      "cloudmail_path_messages": "/api/public/emailList"
    }
    

API

POST /api/public/emailList requires an Authorization header containing the configured token. It accepts { "toEmail": "name@yyggslive.cc.cd", "size": 20 } and returns { "code": 200, "data": [...] }.

The Worker stores message bodies in D1. Add a scheduled cleanup query before using it long-term, for example deleting messages older than seven days.