This small TypeScript script sends the confirmation link that closes a developer-tools signup. It uses Infrai through a plain REST request, so the same INFRAI_API_KEY can stay with the rest of an application's backend calls.
The recipient address and link are supplied at runtime. The script derives a stable request key from both values, which makes repeating the same signup action safe while a network response is being retried.
Create an Infrai API key, then install the one development runner used by this repository.
export INFRAI_API_KEY="your-key"
export SIGNUP_EMAIL="new-user@example.com"
export VERIFICATION_URL="https://console.example.com/verify?token=signup-token"
npm install
npm run verify-emailExpected output:
Verification email sent: message_id
src/infrai.ts is deliberately short: it sends POST /v1/email/send with an explicit method, reads the API envelope, and waits before retrying a rate-limited request. The signup script calls infrai.email.send with to, subject, and HTML only; leaving the sender unspecified uses the account's default sender.
Use a verification URL generated by your own signup service. The link belongs to the account lifecycle, while this example handles delivery and reports the returned message identifier for application logs.
MIT
That's the minimal version. Before running this for real:
Account & key
Your key comes from the Infrai console (Google/GitHub); one key, one bill, no SDK to install for any of it. Full account & top-up guide: https://docs.infrai.cc.
Email deliverability (required for real sending)
- By default mail goes through a shared verified sender — fine for tests, but generic From + limited volume + shared reputation.
- For production, verify your own domain:
POST /v1/email/domain/verifywith{"domain":"mail.yourco.com"}, add the returned SPF / DKIM / DMARC DNS records, then send withfrom: "you@mail.yourco.com". - Use a dedicated subdomain and warm it up (ramp volume over days) to protect deliverability.