0% found this document useful (0 votes)
276 views

Send EmailJS

The /send endpoint allows sending an email using an email template and dynamic parameters. A POST request is made to the API URL containing the required service_id, template_id, user_id, and optional template_params and accessToken. The response will return a 200 status for success or a 400 status for failure. Sample code using jQuery shows how to make the request and handle the response.

Uploaded by

franklin bolivar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
276 views

Send EmailJS

The /send endpoint allows sending an email using an email template and dynamic parameters. A POST request is made to the API URL containing the required service_id, template_id, user_id, and optional template_params and accessToken. The response will return a 200 status for success or a 400 status for failure. Sample code using jQuery shows how to make the request and handle the response.

Uploaded by

franklin bolivar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

24/6/2021 /send | EmailJS

/send
Sends an email based on the specified email template and the passed dynamic parameters. The
email is sent via the specified email service or via the default service if default_service keyword is
passed.

Resource URL

POST https://api.emailjs.com/api/v1.0/email/send

Request Information

Content type is 'application/json'

Rate Limit

1 request per second

Parameters
NAME REQUIRED DESCRIPTION

service_id Yes Service ID of the service through which the email should be
sent. Reserved keyword default_service is supported, and
should be used to use the default service, which can be set and
changed via EmailJS dashboard.

template_id Yes Template ID of the email

user_id Yes User ID of the account

template_params No Template parameters of the template

accessToken No Access Token of the account (private key)

https://www.emailjs.com/docs/rest-api/send/ 1/3
24/6/2021 /send | EmailJS

Response Information

Response formats is JSON or Text

Example Response

Success status:

200 "OK"

Failure status:

400 "The user_id parameter is required"

Code Example

For this example we will use jQuery library. It has ajax and supports very old browsers.

// code fragment

var data = {

service_id: 'YOUR_SERVICE_ID',

template_id: 'YOUR_TEMPLATE_ID',

user_id: 'YOUR_USER_ID',

template_params: {

'username': 'James',

'g-recaptcha-response': '03AHJ_ASjnLA214KSNKFJAK12sfKASfehbmfd...'

};

$.ajax('https://api.emailjs.com/api/v1.0/email/send', {

type: 'POST',

data: JSON.stringify(data),

contentType: 'application/json'

}).done(function() {

alert('Your mail is sent!');

}).fail(function(error) {

alert('Oops... ' + JSON.stringify(error));

});

// code fragment
https://www.emailjs.com/docs/rest-api/send/ 2/3
24/6/2021 /send | EmailJS

https://www.emailjs.com/docs/rest-api/send/ 3/3

You might also like