[Node.js SDK]
Fastify
High-performance Fastify routes that send email through Reloop with the Node.js SDK.
Step 1
Install the package
Add the official Node.js client to your Fastify project.
bash
npm install reloop-emailStep 2
Set your API key
Create a free Reloop account, copy your API key, and add it to your Fastify environment.
Get an API key free โbash
RELOOP_API_KEY="re_xxxxxxxx"Step 3
Send email from Fastify
Use this Fastify snippet to send your first message. Works with Plugins ยท Routes.
send_email.ts
1import Fastify from 'fastify';2import Reloop from 'reloop-email';3
4const app = Fastify();5const reloop = new Reloop(process.env.RELOOP_API_KEY);6
7app.post('/send', async () => {8 const { data, error } = await reloop.emails.send({9 from: 'Acme <onboarding@yourdomain.com>',10 to: ['delivered@yourdomain.com'],11 subject: 'Hello from Fastify',12 html: '<strong>It works!</strong>',13 });14
15 if (error) throw error;16 return { id: data.id };17});18
19await app.listen({ port: 3000 });Next steps
Examples, docs, and API reference
Go deeper with working code and the full API for Node.js.
Other frameworks
Same API, framework-specific examples.
Send with Fastify.
Get an API key and ship transactional email from Fastify using the official Node.js SDK.