smarter email strategy
Make the most of these powerful touchpoints between your brand and your customers.
curl --request POST \
--url https://control.msg91.com/api/v5/email/send \
--header 'Authkey: <authkey>' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{"to":[{"name":"Mark","email":"[email protected]"}],"from":{"name":"Joe","email":"[email protected]"},"cc":[{"email":"[email protected]"},{"email":"[email protected]"}],"bcc":[{"email":"[email protected]"},{"email":"[email protected]"}],"domain":"The domain which you have registered with us. We sign DKIM with this domain.","mail_type_id":"1 for Transactional, 2 for Notificational, 3 for Promotional - Default is 3","in_reply_to":"If the current mail is reply of any mail then that mail Message ID.","reply_to":[{"email":"[email protected]"},{"email":"[email protected]"}],"attachments":[{"filePath":"Public path for file.","fileName":"File Name"},{"file":"File in Data URI format data:content/type;base64,<data>.","fileName":"File Name"}],"template_id":"YOUR_UNIQUE_TEMPLATE_NAME","variables":{"VAR1":"VAR1 VALUE","VAR2":"VAR2 VALUE"}}
'
const http = require("https");
const options = {
"method": "POST",
"hostname": "control.msg91.com",
"port": null,
"path": "/api/v5/email/send",
"headers": {
"Authkey": "<authkey>",
"accept": "application/json",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
to: [{name: 'Mark', email: '[email protected]'}],
from: {name: 'Joe', email: '[email protected]'},
cc: [{email: '[email protected]'}, {email: '[email protected]'}],
bcc: [{email: '[email protected]'}, {email: '[email protected]'}],
domain: 'The domain which you have registered with us. We sign DKIM with this domain.',
mail_type_id: '1 for Transactional, 2 for Notificational, 3 for Promotional - Default is 3',
in_reply_to: 'If the current mail is reply of any mail then that mail Message ID.',
reply_to: [{email: '[email protected]'}, {email: '[email protected]'}],
attachments: [
{filePath: 'Public path for file.', fileName: 'File Name'},
{
file: 'File in Data URI format data:content/type;base64,<data>.',
fileName: 'File Name'
}
],
template_id: 'YOUR_UNIQUE_TEMPLATE_NAME',
variables: {VAR1: 'VAR1 VALUE', VAR2: 'VAR2 VALUE'}
}));
req.end();
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://control.msg91.com/api/v5/email/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "\n{\"to\":[{\"name\":\"Mark\",\"email\":\"[email protected]\"}],\"from\":{\"name\":\"Joe\",\"email\":\"[email protected]\"},\"cc\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"bcc\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"domain\":\"The domain which you have registered with us. We sign DKIM with this domain.\",\"mail_type_id\":\"1 for Transactional, 2 for Notificational, 3 for Promotional - Default is 3\",\"in_reply_to\":\"If the current mail is reply of any mail then that mail Message ID.\",\"reply_to\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"attachments\":[{\"filePath\":\"Public path for file.\",\"fileName\":\"File Name\"},{\"file\":\"File in Data URI format data:content/type;base64,<data>.\",\"fileName\":\"File Name\"}],\"template_id\":\"YOUR_UNIQUE_TEMPLATE_NAME\",\"variables\":{\"VAR1\":\"VAR1 VALUE\",\"VAR2\":\"VAR2 VALUE\"}}\n",
CURLOPT_HTTPHEADER => [
"Authkey: <authkey>",
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://control.msg91.com/api/v5/email/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["Authkey"] = '<authkey>'
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request.body = "\n{\"to\":[{\"name\":\"Mark\",\"email\":\"[email protected]\"}],\"from\":{\"name\":\"Joe\",\"email\":\"[email protected]\"},\"cc\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"bcc\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"domain\":\"The domain which you have registered with us. We sign DKIM with this domain.\",\"mail_type_id\":\"1 for Transactional, 2 for Notificational, 3 for Promotional - Default is 3\",\"in_reply_to\":\"If the current mail is reply of any mail then that mail Message ID.\",\"reply_to\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"attachments\":[{\"filePath\":\"Public path for file.\",\"fileName\":\"File Name\"},{\"file\":\"File in Data URI format data:content/type;base64,<data>.\",\"fileName\":\"File Name\"}],\"template_id\":\"YOUR_UNIQUE_TEMPLATE_NAME\",\"variables\":{\"VAR1\":\"VAR1 VALUE\",\"VAR2\":\"VAR2 VALUE\"}}\n"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("control.msg91.com")
payload = "\n{\"to\":[{\"name\":\"Mark\",\"email\":\"[email protected]\"}],\"from\":{\"name\":\"Joe\",\"email\":\"[email protected]\"},\"cc\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"bcc\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"domain\":\"The domain which you have registered with us. We sign DKIM with this domain.\",\"mail_type_id\":\"1 for Transactional, 2 for Notificational, 3 for Promotional - Default is 3\",\"in_reply_to\":\"If the current mail is reply of any mail then that mail Message ID.\",\"reply_to\":[{\"email\":\"[email protected]\"},{\"email\":\"[email protected]\"}],\"attachments\":[{\"filePath\":\"Public path for file.\",\"fileName\":\"File Name\"},{\"file\":\"File in Data URI format data:content/type;base64,<data>.\",\"fileName\":\"File Name\"}],\"template_id\":\"YOUR_UNIQUE_TEMPLATE_NAME\",\"variables\":{\"VAR1\":\"VAR1 VALUE\",\"VAR2\":\"VAR2 VALUE\"}}\n"
headers = {
'Authkey': "<authkey>",
'accept': "application/json",
'content-type': "application/json"
}
conn.request("POST", "/api/v5/email/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Unlock the Power of Transactional Email with Our Bulk Transactional Email API
Welcome to MSG91, the leading best email API service provider for developers in India. With our state-of-the-art transactional email delivery solutions, we empower businesses to effortlessly send important, personalized emails to their customers at scale.