Skip to content

alivefree/cf-email-workers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudflare email sender worker

Modify wrangler.toml

# Configure domain names to allow cros
ALLOWED_ORIGINS = "*"
# Address to receive mail
RECIPIENT_ADDRESS = "*"
# Address to send mail
SENDER_ADDRESS = "*"
# sender name
SENDER_NAME = "*"

Deploy in Cloudflare

  1. install wrangler
    npm install -g wrangler
  2. login to cloudflare
    wrangler login
  3. deploy
    wrangler deploy

use yourself 'Send Email Binding'

  try {
      await c.env.SEB.send(message)
  } catch (e) {
      c.status(500)
      return c.json({
          "status": "error",
          "message": "Email failed to send",
          "error_details": e.message
      });
  }

The SEB in the above code comes from the configuration in wrangler.toml:

send_email = [
    {type = "send_email", name = "SEB", destination_address = "xxx"},
]

About

A email sender worker by cloudflare

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published