A private api service for sending email powered by Cloudflare worker project.
- Prepare a domian, such as
formtome.com
. Now, add a website in cloudflare-dashboard and build your domain. It maybe cost you about 30min. - Select your site and domain, Enable Email Routing. It maybe cost you about 5min.
- Install warngler for delpoy cf worker. Ensure your node version >= 16.13.0 and run :
npm install wrangler@latest -g
- Get the code
git clone [email protected]:maojindao55/cf-send-email-worker.git
- Custom
wrangler.toml
name = "send-email-api"
main = "./index.js"
compatibility_date = "2022-05-03"
[[send_email]]
type = "send_email"
name = "SEB"
allowed_destination_addresses = ["[email protected]"]
# Here, replace your verified email address.
- Deploy your worker
wrangler deploy --name send-email-worker-api
http://{{your-cf-worker-prefix}}.workers.dev/
POST
Name | Type | Description |
---|---|---|
sender_email |
string |
The email address of the sender. |
sender_name |
string |
The name of the sender. |
recipient_email |
string |
The email address of the recipient. |
subject |
string |
The subject of the email. |
msg_data |
string |
The message body of the email. |
curl -d"[email protected]&sender_name=FromWorker&[email protected]&subject='Hello Guy!'&msg_data='My first email sent!'" "http://send-email-worker-api.workers.dev/"