Sending Individual Emails
Send emails using our API, the Node.js SDK, or the dashboard interface. This guide covers all three approaches.
Using the Notify NPM Package
First, install the Notify NPM package:
npm install notifycx
Then, use the following code to send a basic email, or one with variables (i.e. template-based):
import Notify from 'notifycx';
const notify = new Notify(process.env.NOTIFY_API_KEY);
// Send a basic email
await notify.sendEmail({
to: 'recipient@example.com',
subject: 'Hello!',
name: 'John Doe',
message: 'Your email content here'
});
// Send using a template
await notify.sendEmailFromTemplate({
to: 'recipient@example.com',
from: 'noreply@notify.cx',
templateId: '<your_template_id>',
variables: {
name: 'John Doe',
order_id: 'ORD-123'
}
});
Using the Notify API
// Basic email
await fetch('https://notify.cx/api/send-email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.NOTIFY_API_KEY
},
body: JSON.stringify({
to: 'recipient@example.com',
subject: 'Hello!',
name: 'John Doe',
message: 'Your email content here'
})
});
// Template email
await fetch('https://notify.cx/api/send-email-from-template', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.NOTIFY_API_KEY
},
body: JSON.stringify({
to: 'recipient@example.com',
from: 'noreply@notify.cx',
templateId: '<your_template_id>',
variables: {
name: 'John Doe',
order_id: 'ORD-123'
}
})
});
Sending via Dashboard
Basic Emails
- Navigate to notify.cx/dashboard/email/send
- Fill in recipient details
- Compose your message
- Click "Send Email"
Template Emails
- Go to notify.cx/dashboard/email/template-send
- Select your template
- Fill in variables
- Preview the email
- Send to recipient
Tracking Delivery
Via Dashboard
- Visit notify.cx/dashboard/logs or notify.cx/dashboard/analytics
- Find your email
- View content of email, delivery status, and more.
Via API
Coming soon.
Via NPM Package
Coming soon.
Next Steps
- Learn about testing emails
- Explore analytics and monitoring
- Review best practices