# /send-form
Sends an email based on the specified email template using a multi-part form structure. This endpoint is required when transmitting binary files (attachments) or fields encoded as multipart/form-data.
# Resource URL
POST https://api.emailjs.com/api/v1.0/email/send-form
# Request Information
Content type is 'multipart/form-data'
# 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 primary_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 | Public Key of the account |
accessToken | No | Private Key of the account |
# Response Information
Response formats is JSON or Text
# Example Response
Success status:
200 "OK"
Failure status:
422 "The recipients address is corrupted"
# Code Example
The following examples demonstrate how to interact with the REST API using multipart encoding. These snippets are provided for illustration purposes only; any platform capable of constructing multipart/form-data requests can utilize this endpoint.
# cURL (CLI)
curl -X POST https://emailjs.com/api/v1.0/email/send-form \
-F "service_id=YOUR_SERVICE_ID" \
-F "template_id=YOUR_TEMPLATE_ID" \
-F "user_id=YOUR_PUBLIC_KEY"
# TypeScript (Fetch API)
const formData = new FormData();
formData.append('service_id', 'YOUR_SERVICE_ID');
formData.append('template_id', 'YOUR_TEMPLATE_ID');
formData.append('user_id', 'YOUR_PUBLIC_KEY');
try {
const response = await fetch('https://emailjs.com/api/v1.0/email/send-form', {
method: 'POST',
body: formData // Content-Type header with boundaries is automatically handled by the environment
});
if (!response.ok) {
throw response.status;
}
console.log('Email sent successfully');
} catch (error) {
console.error('Error sending email:', error);
}