/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" 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

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