{"id":13564774,"url":"https://github.com/Sh4yy/cloudflare-email","last_synced_at":"2025-04-03T21:31:46.497Z","repository":{"id":175382600,"uuid":"653802091","full_name":"Sh4yy/cloudflare-email","owner":"Sh4yy","description":"This is a simple proxy server that can be used for sending free transactional emails through Cloudflare workers.","archived":false,"fork":false,"pushed_at":"2024-04-28T18:02:18.000Z","size":30,"stargazers_count":1512,"open_issues_count":13,"forks_count":375,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-03-31T21:48:59.411Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sh4yy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-06-14T19:10:04.000Z","updated_at":"2025-03-29T11:14:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb7af7c4-cd12-4b82-9e64-456f3b181b8d","html_url":"https://github.com/Sh4yy/cloudflare-email","commit_stats":null,"previous_names":["sh4yy/cloudflare-email"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fcloudflare-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fcloudflare-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fcloudflare-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fcloudflare-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sh4yy","download_url":"https://codeload.github.com/Sh4yy/cloudflare-email/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247083683,"owners_count":20880890,"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":[],"created_at":"2024-08-01T13:01:35.700Z","updated_at":"2025-04-03T21:31:46.135Z","avatar_url":"https://github.com/Sh4yy.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003cimg src=\"https://github.com/Sh4yy/cloudflare-email/assets/23535123/36a28753-7ded-45ef-bfed-fcc308658b33\" alt=\"Cloudflare Worker Email Server\"/\u003e\n\t\u003cbr\u003e\n  \u003ch1\u003eCloudflare Worker Email Server\u003c/h1\u003e\n\t\u003cp\u003eSend free transactional emails from your Cloudflare Workers using MailChannels.\u003c/p\u003e\n\u003c/div\u003e\n\n\n## Getting Started!\n\n1. Clone this repository\n2. Install the dependencies with `npm install`\n3. Use the command `npx wrangler secret put --env production TOKEN` to deploy a securely stored token to Cloudflare. With this command, you will be prompted to enter a random secret value, which will be used to authenticate your requests with the HTTP `Authorization` header as described below. You can also set this encrypted value directly in your Cloudflare dashboard.\n4. Deploy the worker with `npm run deploy`\n\nOr deploy directly to Cloudflare\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/Sh4yy/cloudflare-email)\n\n## Setup SPF\n\nSPF is a DNS record that helps prevent email spoofing. You will need to add an SPF record to your domain to allow MailChannels to send emails on your behalf.\n\n1. Add a `TXT` record to your domain with the following values:\n\n\t\t- Name: `@`\n\t\t- Value: `v=spf1 a mx include:relay.mailchannels.net ~all`\n\nNote: If you're facing [Domain Lockdown error](https://support.mailchannels.com/hc/en-us/articles/16918954360845-Secure-your-domain-name-against-spoofing-with-Domain-Lockdown), follow the below steps:\n\n1. Create a `TXT` record with the following values:\n\n\t\t- Name: `_mailchannels`\n\t\t- Value: `v=mc1 cfid=yourdomain.workers.dev` (the value of `cfid` will also be present in the error response)\n\n## Setup DKIM\n\nThis step is optional, but highly recommended. DKIM is a DNS record that helps prevent email spoofing. You may follow the steps listed in the [MailChannels documentation](https://support.mailchannels.com/hc/en-us/articles/7122849237389-Adding-a-DKIM-Signature) to set up DKIM for your domain.\n\n## Usage\n\nOnce you have deployed this worker function to Cloudflare Workers, you can send emails by making a `POST` request to the worker on the `/api/email` endpoint with the following parameters:\n\n- Note you need to pass an `Authorization` header with the secure token you deployed. Like the following: `Authorization: TOKEN`\n\n### Basic Email\n\nThe Most basic request would look like this:\n\n```json\n{\n\t\"to\": \"john@example.com\",\n\t\"from\": \"me@example.com\",\n\t\"subject\": \"Hello World\",\n\t\"text\": \"Hello World\"\n}\n```\n\n### HTML Emails\n\nYou can also send HTML emails by adding an `html` parameter to the request. This can be used in conjunction with the `text` parameter to send a multi-part email.\n\n```json\n{\n\t\"to\": \"john@example.com\",\n\t\"from\": \"me@example.com\",\n\t\"subject\": \"Hello World\",\n\t\"html\": \"\u003ch1\u003eHello World\u003c/h1\u003e\"\n}\n```\n\n### Sender and Recipient Name\n\nYou can also specify a sender and recipient name by adding a `name` parameter to the request. This can be used for both the `to` and `from` parameters.\n\n```json\n{\n\t\"to\": { \"email\": \"john@example.com\",  \"name\": \"John Doe\" },\n\t\"from\": { \"email\": \"me@example.com\", \"name\": \"Jane Doe\" },\n\t\"subject\": \"Hello World\",\n\t\"text\": \"Hello World\"\n}\n```\n\n### Sending to Multiple Recipients\n\nYou may also send to multiple recipients by passing an array of emails, or an array of objects with `email` and `name` properties.\n\n```json\n{\n\t\"to\": [\n\t\t\"john@example.com\",\n\t\t\"rose@example.com\"\n \t],\n\t\"from\": \"me@example.com\",\n\t\"subject\": \"Hello World\",\n\t\"text\": \"Hello World\"\n}\n```\n\nor\n\n```json\n{\n\t\"to\": [\n\t\t{ \"email\": \"john@example.com\", \"name\": \"John Doe\" },\n\t\t{ \"email\": \"rose@example.com\", \"name\": \"Rose Doe\" }\n \t],\n\t\"from\": \"me@example.com\",\n\t\"subject\": \"Hello World\",\n\t\"text\": \"Hello World\"\n}\n```\n\n### Sending BCC and CC\n\nYou can also send BCC and CC emails by passing an array of emails, an object with `email` and `name` properties, or an array of either, similar to the `to` parameter.\n\n```json\n{\n\t\"to\": \"john@example.com\",\n\t\"from\": \"me@example.com\",\n\t\"subject\": \"Hello World\",\n\t\"text\": \"Hello World\",\n\t\"cc\": [\n\t\t\"jim@example.com\",\n\t\t\"rose@example.com\"\n\t],\n\t\"bcc\": [\n\t\t\"gil@example.com\"\n\t]\n}\n```\n\n### Reply To\n\nYou can also specify a reply to email address by adding a `replyTo` parameter to the request. Again, you can use an email string, an object with `email` and `name` properties, or an array of either.\n\n```json\n{\n\t\"to\": \"john@example.com\",\n\t\"from\": \"me@example.com\",\n\t\"replyTo\": \"support@example.com\",\n\t\"subject\": \"Hello World\",\n\t\"text\": \"Hello World\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSh4yy%2Fcloudflare-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSh4yy%2Fcloudflare-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSh4yy%2Fcloudflare-email/lists"}