# emailjs.sendForm
An automated method that serializes and extracts key-value inputs directly from a DOM form element or a defined container query selector, mapping them instantly to your email template variables.
# Syntax
emailjs.sendForm(serviceID, templateID, form, 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 |
form | String, HTMLFormElement | It can be HTMLFormElement or query selector |
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
try {
await emailjs.sendForm('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID', '#myForm');
console.log('Email sent successfully');
} catch (error) {
console.error('Error sending email - ', error.text);
}
← emailjs.send /send →