Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

reactjs-mailer

kushalkushal491MIT4.0.9

A tiny JS SDK to send emails via your API

email, email sender, send email, email API, email service, transactional email, nodejs email, smtp, mail utility, email integration, bulk email, email notifications, email automation, api, javascript

readme

Email Sender API Integration

npm version

Overview

This API allows developers to programmatically send emails and check their sending quota. It's designed for easy integration into various applications, from simple scripts to complex web platforms.

Documentation and Support

For more detailed information about the API, including advanced usage, error handling, and best practices, please refer to the full API documentation:

Link to API Documentation Website

If you have any questions, encounter issues, or need support, please visit our support page or contact us:

Link to Support Website or Contact Information

Website

Visit our website to learn more about our services and offerings:

Link to Main Website

Keywords

Email API, Email Sending, REST API, Integration, SaaS, Authentication, Rate Limiting, Send Email, Check Quota, Webhooks

Base URL

All API requests should be made to the following base URL:

https://saas-email-production.up.railway.app/api

Authentication

All API requests require authentication via an API key. You must include your API key in the x-api-key header of each request.

x-api-key: YOUR_API_KEY

To api key generation visit : Link to Main Website

Remember to replace YOUR_API_KEY with your actual API key.

Rate Limiting

To ensure fair usage and prevent abuse, the API implements rate limiting. The limits vary based on your subscription tier:

  • Free tier: 10 emails per minute, 100 per hour, 1,000 per day
  • Standard tier: 50 emails per minute, 500 per hour, 5,000 per day
  • Premium tier: 100 emails per minute, 1,000 per hour, 10,000 per day

Be mindful of these limits when integrating the API into your application.

API Endpoints

1. Send Email

This endpoint allows you to send emails to one or more recipients.

Method: POST Endpoint: /api/email/send

Request Headers:

  • Content-Type: application/json
  • x-api-key: YOUR_API_KEY

Request Body Parameters (JSON):

Parameter Type Required Description
to string Yes Email address of the recipient(s). Can be a single address or an array.
subject string Yes Subject line of the email.
text string Yes Plain text content of the email. Either text or html is required.
html string Yes HTML content of the email. Either text or html is required.
from string Yes Email address of the sender. Defaults to the system's address.
replyTo string No Email address where replies should be sent.
attachments string No (currently unavailable will update soon)
contentType string Yes ( it's usually inferred from the presence of text or html)

Example cURL Request:

curl -X POST https://saas-email-production.up.railway.app/api/email/send \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "to": "recipient@example.com",
    "subject": "Hello from the API",
    "text": "This is a test email sent from the API"
  }'

2. Check Quota

This endpoint allows you to check your current email sending quota and usage.

Method: GET
Endpoint: /api/email/quota

Request Headers:

x-api-key: YOUR_API_KEY

Response (JSON):

{
  "quota": 1000,
  "used": 25,
  "remaining": 975
}

Integrating Your sendEmail Function as an npm Package

Here's how to structure it as a package:

3. Usage Example

import { sendEmail } from "reactjs-mailer";

async function main() {
  try {
    const result = await sendEmail({
      apiKey: "ems_Hr7gMyXSB",
      to: "kushalhail.com",
      from: "ku00@gmail.com",
      subject: "Hello from my npm package!",
      text: "This is a test email sent using my custom npm package.",
      html:"",
      replyTo:"",
      contentType:"application/json"
    });
    console.log('Email sent successfully:', result);
  } catch (error) {
    console.error('Failed to send email:', error.message);
  }
}

main();

Author

Kushal Khandelwal

LinkedIn Kushal Khandelwal

Instagram @kushal___khandelwal