{"id":15663982,"url":"https://github.com/winstxnhdw/mail-worker","last_synced_at":"2025-04-28T15:45:55.340Z","repository":{"id":154753615,"uuid":"618856919","full_name":"winstxnhdw/mail-worker","owner":"winstxnhdw","description":"A mail worker built with Cloudflare Workers and AWS SES.","archived":false,"fork":false,"pushed_at":"2025-04-22T17:03:22.000Z","size":2734,"stargazers_count":30,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-22T18:30:00.209Z","etag":null,"topics":["aws-ses","bun","cloudflare-workers"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winstxnhdw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-25T14:57:23.000Z","updated_at":"2025-04-22T17:03:29.000Z","dependencies_parsed_at":"2024-02-27T23:23:22.081Z","dependency_job_id":"1b54710b-5bea-4bec-baec-08fdb813b343","html_url":"https://github.com/winstxnhdw/mail-worker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"winstxnhdw/node-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winstxnhdw%2Fmail-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winstxnhdw%2Fmail-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winstxnhdw%2Fmail-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winstxnhdw%2Fmail-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winstxnhdw","download_url":"https://codeload.github.com/winstxnhdw/mail-worker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251341892,"owners_count":21574230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-ses","bun","cloudflare-workers"],"created_at":"2024-10-03T13:40:42.754Z","updated_at":"2025-04-28T15:45:55.331Z","avatar_url":"https://github.com/winstxnhdw.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mail-worker\n\n[![main.yml](https://github.com/winstxnhdw/mail-worker/actions/workflows/main.yml/badge.svg)](https://github.com/winstxnhdw/mail-worker/actions/workflows/main.yml)\n[![deploy.yml](https://github.com/winstxnhdw/mail-worker/actions/workflows/deploy.yml/badge.svg)](https://github.com/winstxnhdw/mail-worker/actions/workflows/deploy.yml)\n[![formatter.yml](https://github.com/winstxnhdw/mail-worker/actions/workflows/formatter.yml/badge.svg)](https://github.com/winstxnhdw/mail-worker/actions/workflows/formatter.yml)\n\n`mail-worker` is a robust [Cloudflare Worker](https://workers.cloudflare.com/) built for sending emails with [AWS SES](https://aws.amazon.com/ses/) and [Bun](https://github.com/oven-sh/bun).\n\n## Development\n\nInstall all dependencies.\n\n```bash\nbun install\n```\n\n## Usage\n\n`POST` **`/`** `(send email to recipient(s))`\n\n### Request Headers\n\n\u003e | name          |  type    | description                       |\n\u003e | ------------- | -------- | --------------------------------- |\n\u003e | Authorization | optional | `AUTH_TOKEN` environment variable |\n\n### Parameters\n\n#### MailRequestSchema\n\n\u003e | name        |  type    | data type      | description                   |\n\u003e | ----------- | -------- | ---------------| ----------------------------- |\n\u003e | from        | required | `string`       | sender's email address        |\n\u003e | to          | required | `string[]`     | recipient's email address(es) |\n\u003e | cc          | optional | `string[]`     | cc recipient's email address  |\n\u003e | bcc         | optional | `string[]`     | bcc recipient's email address |\n\u003e | subject     | optional | `string`       | email subject                 |\n\u003e | html        | optional | `string`       | email content                 |\n\u003e | attachments | optional | `Attachment[]` | email attachments             |\n\n#### AttachmentSchema\n\n\u003e | name        |  type    | data type | description                              |\n\u003e | ----------- | -------- | ----------| ---------------------------------------- |\n\u003e | name        | optional | `string`  | name of the attachment                   |\n\u003e | content     | required | `base64`  | base64-encoded content of the attachment |\n\u003e | type        | required | `string`  | MIME type of the attachment              |\n\n### Responses\n\n\u003e | http code | content-type | reason                                                               |\n\u003e | --------- | ------------ | -------------------------------------------------------------------- |\n\u003e | `200`     | `text/plain` | email sent successfully                                              |\n\u003e | `400`     | `text/plain` | invalid request body                                                 |\n\u003e | `401`     | `text/plain` | invalid authentication token                                         |\n\u003e | `500`     | `text/plain` | AWS SES is unavailable/setup incorrectly or the sender is unverified |\n\n### Example cURL\n\n\u003e ```bash\n\u003e curl $MAIL_WORKER_ENDPOINT -H \"Content-Type: application/json\" -d \\\n\u003e '{\n\u003e    \"to\": [\"test@test.com\"],\n\u003e    \"from\": \"test@test.com\",\n\u003e    \"subject\": \"test\",\n\u003e    \"html\": \"test\"\n\u003e  }'\n\u003e ```\n\n### Example cURL with Attachment(s)\n\n\u003e ```bash\n\u003e curl $MAIL_WORKER_ENDPOINT -H \"Content-Type: application/json\" -d \\\n\u003e '{\n\u003e    \"to\": [\"test@test.com\"],\n\u003e    \"from\": \"test@test.com\",\n\u003e    \"subject\": \"test\",\n\u003e    \"html\": \"test\",\n\u003e    \"attachments\": [{\"name\": \"text.txt\", \"type\": \"text/plain\", \"content\": \"SGVsbG8gV29ybGQ=\"}]\n\u003e  }'\n\u003e ```\n\n### Example cURL with Authentication\n\n\u003e ```bash\n\u003e curl $MAIL_WORKER_ENDPOINT \\\n\u003e   -H \"Authorization: $AUTH_TOKEN\" \\\n\u003e   -H \"Content-Type: application/json\" -d \\\n\u003e '{\n\u003e    \"to\": [\"test@test.com\"],\n\u003e    \"from\": \"test@test.com\",\n\u003e    \"subject\": \"test\",\n\u003e    \"html\": \"test\"\n\u003e  }'\n\u003e ```\n\n## Setup\n\n### Environment\n\nYour worker must have the following environment variables.\n\n```bash\necho $AWS_REGION | npx wrangler secret put AWS_REGION\necho $AWS_ACCESS_KEY_ID | npx wrangler secret put AWS_ACCESS_KEY_ID\necho $AWS_SECRET_ACCESS_KEY | npx wrangler secret put AWS_SECRET_ACCESS_KEY\n```\n\n### Authentication\n\nOptionally, you may secure your endpoint by setting the following environment variable.\n\n```bash\necho $AUTH_TOKEN | npx wrangler secret put AUTH_TOKEN\n```\n\n## Verify Email\n\nTo use any sender email, the email must first be verified. The verification will require the following environment variables. You may populate your environment with the following.\n\n```bash\n{\n  echo \"AWS_REGION=$AWS_REGION\"\n  echo \"AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID\"\n  echo \"AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY\"\n} \u003e .env\n```\n\nNow, pipe your email to the `verify-email` script.\n\n```bash\necho $EMAIL_ADDRESS | bun verify-email\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinstxnhdw%2Fmail-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinstxnhdw%2Fmail-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinstxnhdw%2Fmail-worker/lists"}