# emailjs.send

The primary method to programmatically trigger an email dispatch by passing custom data payloads. This method is part of the EmailJS SDK ecosystem and can be utilized across various JavaScript/TypeScript frameworks and runtimes.

# Syntax

emailjs.send(serviceID, templateID, templateParams, options);

# Rate Limit

1 request per second

# Parameters

NAME TYPE DESCRIPTION
serviceID String Service ID of the service through which the email should be sent. Reserved keyword primary_service is supported, and should be used to use the default service, which can be set and changed via EmailJS dashboard
templateID String Template ID of the email
templateParams Object Template parameters of the template
options Options (optional) Locally setting or overriding options. It’s not required if init() method is used

# Result

This asynchronous method resolves to a response object containing status and text properties.

# Code Example

const templateParams = {
  name: 'James',
  notes: 'Check this out!',
};

try {
  await emailjs.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', templateParams);

  console.log('Email sent successfully');
} catch (error) {
  console.error('Error sending email - ', error.text);
}