Use this templateto fork this repository to create your project- Set
Actions Secretsin the projectSettings, add the following environment variables:
### Only For Github Actions
CLOUDFLARE_ACCOUNT_ID="xxx"
CLOUDFLARE_API_TOKEN="xxx"
### Resend mail sending service, you can register for free sending
RESEND_API_KEY="re_xxxx"
### The username of the email sent
EMAIL_USERNAME="No-Reply <[email protected]>"
### Address to receive test emails
TEST_EMAIL_ADDRESS="[email protected]"Modify the wrangler.toml configuration in the project, add:
[[services]]
binding = "RESEND"
service = "email-sender-worker"Then use in the code:
await ctx.env.RESEND.sendEmail({
to: ['[email protected]'], // or just a string
subject: 'Hello, World!',
html: '<h1>Hello, World!</h1>'
}); // returns bWhere the parameter of sendEmail is of type SendEmailOptions:
type SendEmailProps = {
to: string | string[];
subject: string;
html: string;
};# npm, yarn, or pnpm
bun install
bun run devThen visit http://localhost:8787, a test email will be sent to TEST_EMAIL_ADDRESS mailbox.
Donation ways:
- Github: https://github.com/sponsors/willin
- Alipay or Wechat Pay: QRCode
- ETH:
0x6D877f96198E55085CEb56097B099cc7bb814263
MIT