1. Home
  2. Docs
  3. API Documentation
  4. Active APIs
  5. httpSendMail

httpSendMail

This API is deprecated by sendEmail. We encourage the existing users to move to sendEmail as this API is only available for use until April 30, 2024.

This HTTP POST API consists of a single or multiple requests (up to a 1000 requests per call): each request allowing you to provide an HTML content for an email and the email addresses to send the email to.

For every such request, there should be atleast one recipient email address provided for any one of the following parameters: to / cc / bcc. Emails to each of these recipients will be sent separately.

The email addresses provided will get added as subscribers to a new List “API_EMAILS” in your Juvlon Account.

The size of the entire HTTP post should not exceed 32 MB.

URL – https://api2.juvlon.com/v4/httpSendMail.php

JSON Parameters
{"ApiKey":"$ApiKey",
    "requests": 
    [ 
        { 
            "subject":"$subject", 
            "from":"$from", 
            "fromName":"$fromName", 
            "replyto":"$replyto", 
            "to":"$to", 
            "cc":"$cc",
            "bcc":"$bcc",
            "body":"urlencode($body)",
            "customField":"$customField",
            "trackOpens":"$trackOpens",
            "trackClicks":"$trackClicks"
        },
{ 
            "subject":"$subject", 
            "from":"$from", 
            "fromName":"$fromName", 
            "replyto":"$replyto", 
            "to":"$to", 
            "cc":"$cc",
            "bcc":"$bcc",
            "body":"urlencode($body)",
            "customField":"$customField",
            "trackOpens":"$trackOpens",
            "trackClicks":"$trackClicks"
}
] 
}

Arguments

NameTypeDescriptionDefault
ApiKeyStringMandatory for each API call.ApiKey that gives you access to our HTTP APIsThe ApiKey authenticates you and helps us to identify your Juvlon account. It is common for all the requests in an API call and must be provided outside the request(s). 
requestsStructureMandatory for each API call.A list / array of requests for sending out emails. The list of requests should be provided within square braces [ ], and each request should be provided within curly braces { }. 
subjectStringMandatory in each request.The subject of the email to be sent out. The subject cannot have any personalization. 
bodyStringMandatory in each request.The urlencoded HTML content of the email to be sent out. All the images and links will be checked for blacklisted domains, and the email will get sent out only if they are all clean. 
toStringComma separated email addresses to whom the email has to be sent. * 
ccStringComma separated email addresses to whom the email has to be carbon copied. * 
bccStringComma separated email addresses to whom the email has to be blind carbon copied. * 
fromStringMandatory in each request.The email address to be used as the sender of the email.There should be an active sender with the same email address in your Juvlon account. 
fromNameStringThe name to be used for the sender of the email. 
replyToStringThe email address to which replies should be sent. 
customFieldStringCustomized text for your internal tracking. 
trackOpensStringSet flag 1 to enable opens tracking, 0 (default) for no tracking. 
trackClicksStringSet flag 1 to enable clicks tracking, 0 (default) for no tracking. 
* Multiple email addresses provided in these fields will be sent separate individual emails.

Return value

NameTypeDescription
codeStringSuccess or Error response code as returned by the API. Please refer to the section “Possible-Response-Codes”. 
statusStringDescription of the error code returned. 
transactionIdStringA number generated by the API to uniquely identify the current httpSendMail call that was made. Also known as the API_Call_ID. 

Usage / Example(s)

# Try this API. Copy & run this in your terminal.
curl -i -X POST -H "Content-Type: application/json" -d \
'{
   "ApiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
   "requests":[{"subject":"Hello",
                "from":"support@juvlon.com",
                "body":"This is an API test from Juvlon",
                "to":"sales@nichelive.com"}]
}' https://api2.juvlon.com/v4/httpSendMail
# Copy & run this in your Ruby terminal.

require 'net/http'
require 'json'
require 'uri'

uri = URI('https://api2.juvlon.com/v4/httpSendMail')
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
  request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
  request.body = {"ApiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
                  "requests":[{"subject":"Hello",
                               "from":"support@juvlon.com",
                               "body":"This is an API test from Juvlon",
                               "to":"sales@nichelive.com"}]}.to_json
  response = http.request request # Net::HTTPResponse  object
  puts "response #{response.body}"
end
# Copy & run this in your Python terminal.
import json
import requests
url = "https://api2.juvlon.com/v4/httpSendMail"
data = {"ApiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
        "requests":[{"subject":"Hello",
                        "from":"support@juvlon.com",
                        "body":"This is an API test from Juvlon",
                          "to":"sales@nichelive.com"}]}
data_json = json.dumps(data)
r = requests.post(url, data=data_json)

print(r)
$url = 'https://api2.juvlon.com/v4/httpSendMail';
$data = '{"ApiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
    "requests":
          [{
            "subject":"Hello",
            "from":"support@juvlon.com",
            "body":"This is an API test from Juvlon",
            "to":"sales@nichelive.com"             
          }]
        }';
$options = array(
       'http' => array(
           'header'  => "Content-type: application/json\r\n",
           'method'  => 'POST',
           'content' => $data
            )
        );
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
print_r($result);

// Include below 4 references in your program;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

// Include below code in your program
final String POST_PARAMS = "{\"ApiKey\":\"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY\"" +
 
             ",\"requests\":[{\"subject\":\"Hello\"" +
                       ",\"from\":\"support@juvlon.com\"" +
 
                       ",\"body\":\"This is an API test from Juvlon\"" + 
                       ",\"to\":\"sales@nichelive.com\"}]}";

System.out.println(POST_PARAMS);
URL obj = new URL("https://api2.juvlon.com/v4/httpSendMail");
HttpURLConnection postConnection = (HttpURLConnection) obj.openConnection();
postConnection.setRequestMethod("POST");

postConnection.setRequestProperty("Content-Type", "application/json");
postConnection.setDoOutput(true);
OutputStream os = postConnection.getOutputStream();
os.write(POST_PARAMS.getBytes());
os.flush();
os.close();
int responseCode = postConnection.getResponseCode();
System.out.println(responseCode);
// Include below 3 references 
 
using System.Net;
using System.Text;
using System.IO;

// Add below code in your application
string url="https://api2.juvlon.com/v4/httpSendMail";
    HttpWebRequest myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
    myHttpWebRequest.Method = "POST";
    string postData = "{\"ApiKey\":\"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY\"" +
 
                      ",\"requests\":[{\"subject\":\"Hello\"" +
                                        ",\"from\":\"support@juvlon.com\"" + 
                                        ",\"body\":\"This is an API test from Juvlon\"" + 
                                          ",\"to\":\"sales@nichelive.com\"}]}";

byte[] data = Encoding.ASCII.GetBytes(postData);
myHttpWebRequest.ContentType = "application/json";
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
myHttpWebRequest.ContentLength = data.Length;
Stream requestStream = myHttpWebRequest.GetRequestStream();
requestStream.Write(data, 0, data.Length);
requestStream.Close();

HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
Stream responseStream = myHttpWebResponse.GetResponseStream();
StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);
string pageContent = myStreamReader.ReadToEnd();
Console.WriteLine(pageContent);
myStreamReader.Close();
responseStream.Close();
myHttpWebResponse.Close();

Possible-Response-Codes

200   Success: API Request Accepted
401    Error:Invalid Method
402    Error: Unauthorized/Empty Key
403    Error: Unauthorized/Invalid Key
404    Error: Account Sending Blocked
405    Error: Your Juvlon account is expired
406    Error: Email Subject not provided
407    Error: Invalid Email Address for reply-to
408    Error: HTML content not provided
409    Error: Sender Email not Provided
410    Error: Invalid Email Address for Sender
411    Error: No recipient email address provided
412    Error: Invalid recipient email address
413    Error: Blacklisted domain in the HTML
414    Error: Sender Domain Blacklisted
415    Error: Reply-to domain blacklisted ? 
416    Error: Recipient Email Domain blacklist
417    Bounced
418    Delivered
420    Error: Sender email does not exist in your Juvlon account
442    Error:Subscriber Already Exist
443    Error:INACTIVE Subscriber
444    Low Subscriber credit
445    Low Email credit
448    Your Juvlon account is Deactivated
451    Opened
452    Clicked
453    Error: Too many requests per API call
454    Error: API call exceeds the allowed size limitation (32 MB)
475    Error: Json is not valid
476    Error: Subject not valid
477    Error: From Name not valid