{"id":15626381,"url":"https://github.com/sh4yy/vercel-email","last_synced_at":"2025-04-04T08:08:49.799Z","repository":{"id":175618902,"uuid":"653886418","full_name":"Sh4yy/vercel-email","owner":"Sh4yy","description":"A simple npm package that lets you send free transactional emails from Vercel Edge Functions.","archived":false,"fork":false,"pushed_at":"2023-06-25T01:06:24.000Z","size":40,"stargazers_count":429,"open_issues_count":2,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-26T18:52:55.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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-15T00:48:42.000Z","updated_at":"2025-03-07T16:09:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7118eee-c348-4b04-9940-d83b17ac7168","html_url":"https://github.com/Sh4yy/vercel-email","commit_stats":null,"previous_names":["sh4yy/vercel-email"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fvercel-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fvercel-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fvercel-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh4yy%2Fvercel-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sh4yy","download_url":"https://codeload.github.com/Sh4yy/vercel-email/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247137431,"owners_count":20889874,"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-10-03T10:12:15.471Z","updated_at":"2025-04-04T08:08:49.777Z","avatar_url":"https://github.com/Sh4yy.png","language":"TypeScript","funding_links":[],"categories":[],"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=\"Vercel Email Sender\"/\u003e\n\t\u003cbr\u003e\n  \u003ch1\u003eVercel Edge Emails\u003c/h1\u003e\n\t\u003cp\u003eSend free transactional emails from your Vercel edge functions through Cloudflare and MailChannels\u003c/p\u003e\n\u003c/div\u003e\n\n## How it works\n\nThis package only works with Vercel edge functions. Vercel edge functions are serverless functions that run on the edge of the Cloudflare network. Thus, we can take advantage of Cloudflare's free outbound email service which is a result of their partnership with MailChannels. To learn more, visit the [Cloudflare blog post](https://blog.cloudflare.com/sending-email-from-workers-with-mailchannels/).\n\n## Getting Started!\n\n### Install the package\n\n```bash\nnpm install vercel-email\n```\n\n### Create a new edge function\n\n```typescript\n// If you're using App directory\nexport const runtime = 'edge';\n\n// If you're using Pages directory\nexport const config = {\n  runtime: 'edge',\n};\n```\n\n### Import the package\n\n```typescript\nimport Email from 'vercel-email';\n```\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   - Name: `@`\n   - Value: `v=spf1 a mx include:relay.mailchannels.net ~all`\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\n### Basic Email\n\nThe Most basic request would look like this:\n\n```typescript\nawait Email.send({\n  to: 'john@example.com',\n  from: 'me@example.com',\n  subject: 'Hello World',\n  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```typescript\nawait Email.send({\n  to: 'john@example.com',\n  from: 'me@example.com',\n  subject: 'Hello World',\n  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```typescript\nawait Email.send({\n  to: { email: 'john@example.com', name: 'John Doe' },\n  from: { email: 'me@example.com', name: 'Jane Doe' },\n  subject: 'Hello World',\n  text: 'Hello World',\n});\n```\n\n### Sending to Multiple Recipients\n\nYou may also send to multiple recipients by passing an array of eamils, or an array of objects with `email` and `name` properties.\n\n```typescript\nawait Email.send({\n  to: ['john@example.com', 'rose@example.com'],\n  from: 'me@example.com',\n  subject: 'Hello World',\n  text: 'Hello World',\n});\n```\n\nor\n\n```typescript\nawait Email.send({\n  to: [\n    { email: 'john@example.com', name: 'John Doe' },\n    { email: 'rose@example.com', name: 'Rose Doe' },\n  ],\n  from: 'me@example.com',\n  subject: 'Hello World',\n  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 eamils, an object with `email` and `name` properties, or an array of either, similar to the `to` parameter.\n\n```typescript\nawait Email.send({\n  to: 'john@example.com',\n  from: 'me@example.com',\n  subject: 'Hello World',\n  text: 'Hello World',\n  cc: ['jim@example.com', 'rose@example.com'],\n  bcc: ['gil@example.com'],\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```typescript\nawait Email.send({\n  to: 'john@example.com',\n  from: 'me@example.com',\n  replyTo: 'support@example.com',\n  subject: 'Hello World',\n  text: 'Hello World',\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsh4yy%2Fvercel-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsh4yy%2Fvercel-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsh4yy%2Fvercel-email/lists"}