Given below are examples for common use cases to help you get started with ZeptoMail.
Sending test email
curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ****" \ -d '{ "from": {"address": "invoice@zylker.com"}, "to": [{"email_address": {"address": "rebecca@zohomail.com","name": "Rebecca"}}], "subject":"Test Email", "htmlbody":"
"https://api.zeptomail.com/v1.1/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "invoice@zylker.com"}, "to": [{"email_address": {"address": "rebecca@zohomail.com","name": "Rebecca"}}], "subject":"Test Email", "htmlbody":"
import requests import json url = "https://api.zeptomail.com/v1.1/email" payload = "{ "from": { "address": "invoice@zylker.com"}, "to": [{"email_address": {"address": "rebecca@zohomail.com","name": "Rebecca"}}], "subject":"Test Email", "htmlbody":"
// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email"; const token = "Zoho-enczapikey ***"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "invoice@zylker.com" }, "to": [ { "email_address": { "address": "rebecca@zohomail.com", "name": "Rebecca" } } ], "subject": "Test Email", "htmlbody": "
Send an email with attachments (base64)
curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ****" \ -d '{ "from": {"address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "paula@zohomail.com","name": "Paula"}}], "subject":"Test Email", "htmlbody":"
"https://api.zeptomail.com/v1.1/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "paula@zohomail.com","name": "Paula"}}], "subject":"Test Email", "htmlbody":"
import requests import json url = "https://api.zeptomail.com/v1.1/email" payload = "{ "from": {"address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "paula@zohomail.com","name": "Paula"}}], "subject":"Test Email", "htmlbody":"
// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email"; const token = "Zoho-enczapikey ***"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "welcome@zylker.com" }, "to": [ { "email_address": { "address": "paula@zohomail.com", "name": "Paula" } } ], "subject": "Test Email", "htmlbody": "
Send email with attachments (using filecache)
curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ***" \ -d '{ "from": {"address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "john@zohomail.com","name": "John"}}], "subject":"Test Email", "htmlbody":"
"https://api.zeptomail.com/v1.1/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "john@zohomail.com","name": "John"}}], "subject":"Test Email", "htmlbody":"
import requests import json url = "https://api.zeptomail.com/v1.1/email" payload = "{ "from": {"address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "john@zohomail.com","name": "John"}}], "subject":"Test Email", "htmlbody":"
// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email"; const token = "Zoho-enczapikey ***"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "welcome@zylker.com" }, "to": [ { "email_address": { "address": "john@zohomail.com", "name": "John" } } ], "subject": "Test Email", "htmlbody": "
Send email to multiple recipients
curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ****" \ -d '{ "from": {"address": "notifications@zylker.com"}, "to": [ {"email_address": {"address": "natalie@zohomail.com","name": "Natalie"}}, {"email_address": {"address": "samuel@zohomail.com","name": "Samuel"}} ], "bcc": [ {"email_address": {"address": "tim.h@zohomail.com","name": "Tim"}}, {"email_address": {"address": "ruth.l@zohomail.com","name": "Ruth"}} ], "cc": [ {"email_address": {"address": "ron.g@zohomail.com","name": "Ron"}}, {"email_address": {"address": "harry.p@zohomail.com","name": "Harry"}} ], "subject":"Test Email", "htmlbody":"
"https://api.zeptomail.com/v1.1/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "notifications@zylker.com"}, "to": [ {"email_address": {"address": "natalie@zohomail.com","name": "Natalie"}}, {"email_address": {"address": "samuel@zohomail.com","name": "Samuel"}} ], "bcc": [ {"email_address": {"address": "tim.h@zohomail.com","name": "Tim"}}, {"email_address": {"address": "ruth.l@zohomail.com","name": "Ruth"}} ], "cc": [ {"email_address": {"address": "ron.g@zohomail.com","name": "Ron"}}, {"email_address": {"address": "harry.p@zohomail.com","name": "Harry"}} ],"subject":"Test Email", "htmlbody":"
import requests import json url = "https://api.zeptomail.com/v1.1/email" payload = "{ "from": {"address": "notifications@zylker.com"}, "to": [ {"email_address": {"address": "natalie@zohomail.com","name": "Natalie"}}, {"email_address": {"address": "samuel@zohomail.com","name": "Samuel"}} ], "bcc": [ {"email_address": {"address": "tim.h@zohomail.com","name": "Tim"}}, {"email_address": {"address": "ruth.l@zohomail.com","name": "Ruth"}} ], "cc": [ {"email_address": {"address": "ron.g@zohomail.com","name": "Ron"}}, {"email_address": {"address": "harry.p@zohomail.com","name": "Harry"}} ], "subject":"Test Email", "htmlbody":"
// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://zeptomail.zoho.com/"; const token = "Zoho-enczapikey ****"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "notifications@zylker.com" }, "to": [ { "email_address": { "address": "natalie@zohomail.com", "name": "Natalie" } }, { "email_address": { "address": "jakson.m@zohomail.com", "name": "Jackson" } } ], "bcc": [ { "email_address": { "address": "samuel@zohomail.com", "name": "Samuel" } }, { "email_address": { "address": "tim.h@zohomail.com", "name": "Tim" } } ], "cc": [ { "email_address": { "address": "ruth.l@zohomail.com", "name": "Ruth" } }, { "email_address": { "address": "ron.g@zohomail.com", "name": "Ron" } } ], "subject": "Test Email", "htmlbody": "
Single email template
curl "https://api.zeptomail.com/v1.1/email/template" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ****" \ -d '{ "from": {"address": "welcome@zfashions.com"}, "to": [{"email_address": {"address": "erica.samuel@zohomail.com","name": "Erica"}}], "template_key": "ea36f19a.1033669632ce7549.k1.2b3eeef0-198a-11ee-910a-8a90785fcf47.1891b3da35f", "merge_info": {"header": "header", "footer" : "footer"} }'
"https://api.zeptomail.com/v1.1/email/template", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "erica.samuel@zohomail.com","name": "Erica"}}], "subject":"Test Email", "htmlbody":"
import requests import json url = "https://api.zeptomail.com/v1.1/email/template" payload = "{ "from": {"address": "welcome@zylker.com"}, "to": [{"email_address": {"address": "erica.samuel@zohomail.com","name": "Erica"}}], "template_key": "ea36f19a.1033669632ce7549.k1.2b3eeef0-198a-11ee-910a-8a90785fcf47.1891b3da35f", "merge_info": {"header": "header", "footer" : "footer"} }" json_str = json.dumps(payload) headers = { 'accept': "application/json", 'content-type': "application/json", 'authorization': "Zoho-enczapikey ***", } response = requests.request("POST", url, data=json_str, headers=headers) print(response.text)
// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email/template"; const token = "Zoho-enczapikey ***"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "welcome@zylker.com" }, "to": [ { "email_address": { "address": "erica.samuel@zohomail.com", "name": "Erica" } } ], "template_key": "ea36f19a.1033669632ce7549.k1.2b3eeef0-198a-11ee-910a-8a90785fcf47.1891b3da35f", "merge_info": { "header": "header", "footer": "footer" } }).then((resp) => console.log("success")).catch((error) => console.log("error"));
Batch email template
curl "https://api.zeptomail.com/v1.1/email/template/batch" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ***" \ -d '{ "from": {"address": "notifications@zylker.com"}, "to": [ { "email_address": {"address": "michael.s@zohomail.com","name": "Michael"}, "merge_info": {"header": "header", "footer" : "footer"} }, { "email_address": {"address": "anderson97@zohomail.com","name": "Anderson"}, "merge_info": {"header": "header1", "footer" : "footer1"} } ], "template_key": "ea36f19a.1033669632ce7549.k1.2b3eeef0-198a-11ee-910a-8a90785fcf47.1891b3da35f", }'
"https://api.zeptomail.com/v1.1/email/template/batch", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "notifications@zylker.com"}, "to": [ { "email_address": {"address": "michael.s@zohomail.com","name": "Michael"}, "merge_info": {"header": "header", "footer" : "footer"} }, { "email_address": {"address": "anderson97@zohomail.com","name": "Anderson"}, "merge_info": {"header": "header1", "footer" : "footer1"} } ],"subject":"Test Email", "htmlbody":"
import requests import json url = "https://api.zeptomail.com/v1.1/email/template/batch" payload = "{ "from": {"address": "notifications@zylker.com"}, "to": [ { "email_address": {"address": "michael.s@zohomail.com","name": "Michael"}, "merge_info": {"header": "header", "footer" : "footer"} }, { "email_address": {"address": "anderson97@zohomail.com","name": "Anderson"}, "merge_info": {"header": "header1", "footer" : "footer1"} } ], "template_key": "ea36f19a.1033669632ce7549.k1.2b3eeef0-198a-11ee-910a-8a90785fcf47.1891b3da35f", }" json_str = json.dumps(payload) headers = { 'accept': "application/json", 'content-type': "application/json", 'authorization': "Zoho-enczapikey ***", } response = requests.request("POST", url, data=json_str, headers=headers) print(response.text)
// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email/template/batch"; const token = "Zoho-enczapikey ****"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "notifications@zylker.com" }, "to": [ { "email_address": { "address": "michael.s@zohomail.com", "name": "Michael" }, "merge_info": { "header": "header", "footer": "footer" } }, { "email_address": { "address": "anderson97@zohomail.com", "name": "Anderson" }, "merge_info": { "header": "header1", "footer": "footer1" } } ], "template_key": "ea36f19a.1033669632ce7549.k1.2b3eeef0-198a-11ee-910a-8a90785fcf47.1891b3da35f" }).then((resp) => console.log("success")).catch((error) => console.log("error"));
Send email with inline image (base64)
curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ***" \ -d '{ "from": {"address": "invoice@zylker.com"}, "to": [{"email_address": {"address": "george.m@zohomail.com","name": "George"}}], "subject":"Test Email", "htmlbody": "
Sample send mail"https://api.zeptomail.com/v1.1/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "invoice@zylker.com"}, "to": [{"email_address": {"address": "george.m@zohomail.com","name": "George"}}], "subject":"Test Email", "htmlbody": "
Sample send mailimport requests import json url = "https://api.zeptomail.com/v1.1/email" payload = "{"from": {"address": "invoice@zylker.com"}, "to": [{"email_address": {"address": "george.m@zohomail.com","name": "George"}}], "subject":"Test Email", "htmlbody": "
Sample send mail// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email"; const token = "Zoho-enczapikey ***"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "invoice@zylker.com" }, "to": [{ "email_address": { "address": "george.m@zohomail.com", "name": "George" } }], "subject": "Test Email", "htmlbody": "
Sample send mailSend email with inline image (File-cache key)
curl "https://api.zeptomail.com/v1.1/email" \ -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization:Zoho-enczapikey ***" \ -d '{ "from": {"address": "orders@zylker.com"}, "to": [{"email_address": {"address": "richard56@zohomail.com","name": "Richard"}}], "subject":"Test Email", "htmlbody": "
Sample send mail"https://api.zeptomail.com/v1.1/email", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "from": { "address": "orders@zylker.com"}, "to": [{"email_address": {"address": "richard56@zohomail.com","name": "Richard"}}], "subject":"Test Email", "htmlbody": "
Sample send mailimport requests import json url = "https://api.zeptomail.com/v1.1/email" payload = "{"from": {"address": "orders@zylker.com"}, "to": [{"email_address": {"address": "richard56@zohomail.com","name": "Richard"}}], "subject":"Test Email", "htmlbody": "
Sample send mail// For ES6, set type: "module" in package.json. import { SendMailClient } from "zeptomail"; // For CommonJS var { SendMailClient } = require("zeptomail"); const url = "https://api.zeptomail.com/v1.1/email/"; const token = "Zoho-enczapikey ****"; let client = new SendMailClient({url, token}); client.sendMail({ "from": { "address": "orders@zylker.com" }, "to": [{ "email_address": { "address": "richard56@zohomail.com", "name": "Richard" } }], "subject": "Test Email", "htmlbody": "
Sample send mail