# Configure domain names to allow cros
ALLOWED_ORIGINS = "*"
# Address to receive mail
RECIPIENT_ADDRESS = "*"
# Address to send mail
SENDER_ADDRESS = "*"
# sender name
SENDER_NAME = "*"
- install wrangler
npm install -g wrangler
- login to cloudflare
wrangler login
- deploy
wrangler deploy
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"},
]