Bulk SMS API to send Email

http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey

Include Body

{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment&nbsp;<br><br>", "subject":"TestAttachment", "fromEmail":"xyz@gmail.com", "attachmentType":"1", "fromName":"aa", "toEmailSet":[ { "email":"abc@gmail.com", "personName":"toEmail1" }, { "email":"abc@gmail.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email":"bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName":"TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData":"dGV4dCBmaWxl" } ] }

Sample Output

{"responseCode":"3001","response":"2e44d3336e0848b58ca8b2f536b7782c"}

Parameter Name with Description

Parameter Name Data Type Description
AUTH_KEY* Alphanumeric Login Authentication Key(This key is unique for every user)
routeId * Integer Which route you want use for sending sms enter routeId for particular route.use given Id for route. 15 = Transactional Email, 16 = Promotional Email
contentType * Text Content type of email html for html content and text for text content.
mailContent * Text Email content that user want to sent in email.
subject * Text Email subject that user want to sent in email.
fromName * Text Name of sender.
fromEmail * Text Email id of sender like Sender Id
attachmentType * Text Current this parameter email have attachment. 0 have no attachment 1 have attechment.
toEmailSet * Text List of recipient of (To email). email: Email of recipient.person.Name: Name of recipient.
ccEmailSet Text List of cc recipient of (CCemail). email:Email of CC recipient. personName:Name of CC recipient.
bccEmailSet Text List of bcc recipient of (BCCemail). email:Email of BCC recipient.personName:Name of BCC recipient.
attachments Text List of attachments.fileType:Type of file.fileName:Name of File.fileData:File data converted in Base64 format.
CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hnd, CURLOPT_URL, "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "Cache-Control: no-cache"); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\":\"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\": \"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\": \"toEmail2@xyz.com\", \"personName\":\"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\":\"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\": \"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\": \"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }"); CURLcode ret = curl_easy_perform(hnd);
curl -X POST \ 'http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment ", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet": [ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName": "ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email": "bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName": "TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData": "dGV4dCBmaWxl" } ] }'
var client = new RestClient("http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey"); var request = new RestRequest(Method.POST); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("undefined", "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\":\"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\":\"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\":\"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ],\"bccEmailSet\":[ { \"email\": \"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\": \"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\": \"dGV4dCBmaWxl\" } ] }", ParameterType.RequestBody); IRestResponse response = client.Execute(request);
package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey" payload := strings.NewReader("{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\":\"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\": \"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\": \"toEmail2@xyz.com\", \"personName\":\"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\":\"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\": \"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\": \"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Content-Type", "application/json") req.Header.Add("Cache-Control", "no-cache") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) }
OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("text/plain"); RequestBody body = RequestBody.create(mediaType, "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\": \"Test Attachment \n\n\", \"subject\":\"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\": \"toEmail2@xyz.com\", \"personName\":\"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\":\"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\": \"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\": \"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }"); Request request = new Request.Builder() .url("http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey") .post(body) .addHeader("Content-Type", "application/json") .addHeader("Cache-Control", "no-cache") .build(); Response response = client.newCall(request).execute();
HttpResponse<String> response = Unirest.post("http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey") .header("Content-Type", "application/json") .header("Cache-Control", "no-cache") .body("{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\": [ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }") .asString();
var settings = { "async": true, "crossDomain": true, "url": "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey", "method": "POST", "headers": { "Content-Type": "application/json", "Cache-Control": "no-cache" }, "data": "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\": [ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }" } $.ajax(settings).done(function (response) { console.log(response); });
var data = "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\": [ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }"; var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("POST", "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Cache-Control", "no-cache"); xhr.send(data);
var http = require("http"); var options = { "method": "POST", "hostname": "msg.msgclub.net", "path": [ "rest", "services", "sendEmail", "email" ], "headers": { "Content-Type": "application/json", "Cache-Control": "no-cache" } }; var req = http.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function () { var body = Buffer.concat(chunks); console.log(body.toString()); }); }); req.write("{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\": [ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }"); req.end();
var request = require("request"); var options = { method: 'POST', url: 'http://msg.msgclub.net/rest/services/sendEmail/email', qs: { AUTH_KEY: 'authKey' }, headers: { 'Cache-Control': 'no-cache', 'Content-Type': 'application/json' }, body: '{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment \n\n", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email": "ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName":"ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email":"bccEmail2@xyz.co.in", "personName": "bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName":"TestFileone.txt", "fileData": "dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData":"dGV4dCBmaWxl" } ] }' }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); });
var unirest = require("unirest"); var req = unirest("POST", "http://msg.msgclub.net/rest/services/sendEmail/email"); req.query({ "AUTH_KEY": "authKey" }); req.headers({ "Cache-Control": "no-cache", "Content-Type": "application/json" }); req.send("{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\": [ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }"); req.end(function (res) { if (res.error) throw new Error(res.error); console.log(res.body); });
open Cohttp_lwt_unix open Cohttp open Lwt let uri = Uri.of_string "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey" in let headers = Header.init () |> fun h -> Header.add h "Content-Type" "application/json" |> fun h -> Header.add h "Cache-Control" "no-cache" in let body = Cohttp_lwt_body.of_string "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\":\"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\": \"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\": \"toEmail2@xyz.com\", \"personName\":\"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\": \"ccEmail1\" }, { \"email\":\"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\": [ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\" :\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\": \"dGV4dCBmaWxl\" } ] }" in Client.call ~headers ~body `POST uri >>= fun (res, body_stream) -> (* Do stuff with the result *)
<?php $request = new HttpRequest(); $request->setUrl('http://msg.msgclub.net/rest/services/sendEmail/email'); $request->setMethod(HTTP_METH_POST); $request->setQueryData(array( 'AUTH_KEY' => 'authKey' )); $request->setHeaders(array( 'Cache-Control' => 'no-cache', 'Content-Type' => 'application/json' )); $request->setBody('{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment ", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName": "ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email": "bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName": "TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData": "dGV4dCBmaWxl" } ] }'); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
<?php $client = new http\Client; $request = new http\Client\Request; $body = new http\Message\Body; $body->append('{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment ", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName": "ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email": "bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName": "TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData": "dGV4dCBmaWxl" } ] }'); $request->setRequestUrl('http://msg.msgclub.net/rest/services/sendEmail/email'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setQuery(new http\QueryString(array( 'AUTH_KEY' => 'authKey' ))); $request->setHeaders(array( 'Cache-Control' => 'no-cache', 'Content-Type' => 'application/json' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody();
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\":\"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\":\"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\":\"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\": \"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\": \"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\": \"dGV4dCBmaWxl\" } ] }", CURLOPT_HTTPHEADER => array( "Cache-Control: no-cache", "Content-Type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
import http.client conn = http.client.HTTPConnection("msg.msgclub.net") payload = "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }" headers = { 'Content-Type': "application/json", 'Cache-Control': "no-cache" } conn.request("POST", "rest,services,sendEmail,email", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
import requests url = "http://msg.msgclub.net/rest/services/sendEmail/email" querystring = {"AUTH_KEY":"authKey"} payload = "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }" headers = { 'Content-Type': "application/json", 'Cache-Control': "no-cache" } response = requests.request("POST", url, data=payload, headers=headers, params=querystring) print(response.text)
require 'uri' require 'net/http' url = URI("http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request["Cache-Control"] = 'no-cache' request.body = "{ \"routeId\":17, \"contentType\":\"html\", \"mailContent\":\"Test Attachment \n\n\", \"subject\": \"TestAttachment\", \"fromEmail\":\"test@xyz.com\", \"attachmentType\":\"1\", \"fromName\":\"jitendra\", \"toEmailSet\":[ { \"email\":\"toEmail1@xyz.com\", \"personName\":\"toEmail1\" },{ \"email\":\"toEmail2@xyz.com\", \"personName\": \"toEmail2\" } ], \"ccEmailSet\":[ { \"email\":\"ccEmail1@xyz.co.in\", \"personName\":\"ccEmail1\" }, { \"email\": \"ccEmail2@xyz.co.in\", \"personName\":\"ccEmail2@xyz.co.in\" } ], \"bccEmailSet\":[ { \"email\":\"bccEmail1@xyz.co.in\", \"personName\":\"bccEmail1\" }, { \"email\":\"bccEmail2@xyz.co.in\", \"personName\":\"bccEmail2@xyz.co.in\" } ], \"attachments\":[ { \"fileType\":\"text/plain\", \"fileName\":\"TestFileone.txt\", \"fileData\":\"dGV4dCBmaWxl\" }, { \"fileType\":\"text/plain\", \"fileName\":\"testfiletwo.txt\", \"fileData\":\"dGV4dCBmaWxl\" } ] }" response = http.request(request) puts response.read_body
wget --quiet \ --method POST \ --header 'Content-Type: application/json' \ --header 'Cache-Control: no-cache' \ --body-data '{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment \n\n", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email": "ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName":"ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email":"bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName":"TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData":"dGV4dCBmaWxl" } ] }' \ --output-document \ - 'http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey'
echo '{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment ", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName": "ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email": "bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName": "TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData": "dGV4dCBmaWxl" } ] }' | \ http POST 'http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey' \ Cache-Control:no-cache \ Content-Type:application/json
curl --request POST \ --url 'http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY=authKey' \ --header 'Cache-Control: no-cache' \ --header 'Content-Type: application/json' \ --data '{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment \n\n", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email": "ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName":"ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email":"bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName":"TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData":"dGV4dCBmaWxl" } ] }'
#import <Foundation/Foundation.h> NSDictionary *headers = @{ @"Content-Type": @"application/json", @"Cache-Control": @"no-cache" }; NSData *postData = [[NSData alloc] initWithData:[@"{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment ", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName": "ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email":"bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName":"TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData":"dGV4dCBmaWxl" } ] }" dataUsingEncoding:NSUTF8StringEncoding]]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://msg.msgclub.net/rest/ services/sendEmail/email?AUTH_KEY=authKey"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; [request setHTTPMethod:@"POST"]; [request setAllHTTPHeaderFields:headers]; [request setHTTPBody:postData]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"%@", error); } else { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; NSLog(@"%@", httpResponse); } }]; [dataTask resume];
import Foundation let headers = [ "Content-Type": "application/json", "Cache-Control": "no-cache" ] let postData = NSData(data: "{ "routeId":17, "contentType":"html", "mailContent":"Test Attachment ", "subject":"TestAttachment", "fromEmail":"test@xyz.com", "attachmentType":"1", "fromName":"jitendra", "toEmailSet":[ { "email":"toEmail1@xyz.com", "personName":"toEmail1" },{ "email":"toEmail2@xyz.com", "personName":"toEmail2" } ], "ccEmailSet":[ { "email":"ccEmail1@xyz.co.in", "personName":"ccEmail1" }, { "email":"ccEmail2@xyz.co.in", "personName": "ccEmail2@xyz.co.in" } ], "bccEmailSet":[ { "email":"bccEmail1@xyz.co.in", "personName":"bccEmail1" }, { "email": "bccEmail2@xyz.co.in", "personName":"bccEmail2@xyz.co.in" } ], "attachments":[ { "fileType":"text/plain", "fileName": "TestFileone.txt", "fileData":"dGV4dCBmaWxl" }, { "fileType":"text/plain", "fileName":"testfiletwo.txt", "fileData": "dGV4dCBmaWxl" } ] }".data(using: String.Encoding.utf8)!) let request = NSMutableURLRequest(url: NSURL(string: "http://msg.msgclub.net/rest/services/sendEmail/email?AUTH_KEY= authKey")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume()