Skip to content

A mail worker built with Cloudflare Workers and AWS SES.

Notifications You must be signed in to change notification settings

Jguzmanr07/mail-worker

 
 

Repository files navigation

mail-worker

main.yml

mail-worker is a Cloudflare Worker that send emails using AWS SES.

Development

Install all dependencies.

yarn

Usage

POST / (sends email to recipient(s))

Parameters

name type data type description
to required string[] an array of recipient's email address
from required string sender's email address
subject required string email subject
html required string email content

Responses

http code content-type response
200 text/plain Email sent!
400 text/plain Invalid request!
500 text/plain Failed to send email!

Example cURL

curl $MAIL_WORKER_ENDPOINT -H 'Content-Type: application/json' -d \
'{
  "to": ["[email protected]"],
  "from": "[email protected]",
  "subject": "test",
  "html": "test"
}'

Verify Email

To 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.

echo AWS_REGION=$AWS_REGION >> .env
echo AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID >> .env
echo AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY >> .env

Now, pipe your email as stdin to the verify-email script.

echo $EMAIL_ADDRESS | yarn verify-email

About

A mail worker built with Cloudflare Workers and AWS SES.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%