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

sendMailer

This API sends out an existing email in your Juvlon account to an email address or a subscriber ID.

There should be atleast one recipient provided in any one of the following parameters: subID / email. However, if you provide both, then subID takes preference.

You can provide all the personalization details of the recipient that you need in your email, like the first name, last name, etc.. The API will first update any existing subscriber that it finds with the matching subID / email address with these personalization details, and then send the specified email. If there is no existing subscriber with the email address provided, then the API will first create a new subscriber with all the personalization data, and then send out the email to the new subscriber.

This API needs to be called using an HTTP Post method with data in JSON format as shown below.

URL: https://api2.juvlon.com/v4/sendMailer

JSON Parameters
                                
'{"apiKey":"$apiKey", 
"mailerID":"$mailerID", 
"from":"$from", 
"fromName":"$fromName",
"subID":"$subID", 
"email":"$email", 
"mobile":"$mobile", 
"listName":"$listName", 
"prefix":"$prefix", 
"firstName":"$firstName", 
"middleName":"$middleName", 
"lastName":"$lastName", 
"phone":"$phone", 
"address":"$address", 
"city":"$city", 
"state":"$state", 
"pinCode":"$pinCode", 
"country":"$country", 
"residencePhone":"$residencePhone", 
"designation":"$designation", 
"company":"$company", 
"companyAddress":"$company", 
"companyCity":"$company", 
"companyState":"$company", 
"companyCountry":"$company", 
"companyPin":"$company", 
"companyPhone":"$companyPhone", 
"companyFax":"$companyFax", 
"birthday":"$birthday", 
"anniversary":"$anniversary", 
"referenceNo":"$referenceNo", 
"extra1":"$extra1", 
"extra2":"$extra2", 
"extra3":"$extra3", 
"extra4":"$extra4", 
"extra5":"$extra5", 
"extra6":"$extra6", 
"trackOpens":"$trackOpens", 
"trackClicks":"$trackClicks", 
"customField":"$customField" 
}';

                         

Arguments

NameTypeDescriptionDefault
apiKeyStringMandatory. The ApiKey that gives you access to our HTTP APIs.The 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). 
maileridIntMandatory. The message ID of the already created email in your Juvlon account that you would like to send. 
fromStringThis optional parameter is email address to be used as the sender of the email. The email address should be an active registered sender in your Juvlon account. If this parameter is not specified, the assigned address to the mailer (during creation) is used as the “from”. This field is mandatory if fromName is passed as a parameter.
fromNameStringThis optional parameter is name to be used for the sender of the email. If this parameter is not specified, the assigned sender to the mailer (during creation) is used as the “fromName”. Note : If fromName passed then the “from” parameter is mandatory.
subidIntThe subscriber ID of an already existing subscriber in your Juvlon account that you would like to send the email to. 
emailStringThe email address to send the email to.This field is ignored if there is a “subID” present in the API call. 
mobileStringThe mobile number of your recipient. To be used as a personalization in your email. 
listNameStringThe name of an existing list into which you would like to add the recipient as a subscriber.RealTime_Via_API
prefixStringThe prefix / title of your email recipient. E.g. Mr., Mrs., Dr. etc.. To be used as a personalization in your email. 
firstNameStringThe first name of your email recipient. To be used as a personalization in your email. 
middleNameStringThe middle name of your email recipient. To be used as a personalization in your email 
lastNameStringThe last name of your email recipient. To be used as a personalization in your email 
phoneStringThe primary telephone of your email recipient. To be used as a personalization in your email 
addressStringThe residential address of your email recipient. To be used as a personalization in your email 
cityStringThe city in which your email recipient resides. To be used as a personalization in your email 
stateStringThe state in which your email recipient resides. To be used as a personalization in your email 
pinCodeStringThe pin code of your email recipient’s residential address. To be used as a personalization in your email 
countryStringThe Country where your email recipient resides. To be used as a personalization in your email 
residencePhoneStringThe residence phone number of your email recipient. To be used as a personalization in your email 
designationStringThe official designation of your email recipient. To be used as a personalization in your email 
companyStringThe company in which your email recipient works. To be used as a personalization in your email 
companyAddressStringThe company address where your email recipient works. To be used as a personalization in your email 
companyCityStringThe city where your email recipient works. To be used as a personalization in your email 
companyStateStringThe state where your email recipient works. To be used as a personalization in your email 
companyCountryStringThe Country where your email recipient works. To be used as a personalization in your email 
companyPinStringThe pin code of the area where your email recipient works. To be used as a personalization in your email 
companyPhoneStringThe office phone number of your email recipient. To be used as a personalization in your email 
companyFaxStringThe office fax number of your email recipient. To be used as a personalization in your email 
birthdayStringYour email recipient’s birthday in ‘yyyy-mm-dd’ format. Can be used to trigger emails on the recipient’s birthday or as a personalization in emails / SMS. 
anniversaryStringYour email recipient’s anniversary date in ‘yyyy-mm-dd’ format. Can be used to trigger emails on the recipient’s anniversary day or as a personalization in emails / SMS. 
referenceNoStringAny reference number that you want to use for the email recipient. To be used as a personalization in your email 
extra1StringAny extra information that you may like to store about your email recipient. To be used as a personalization in your email 
extra2StringAny extra information that you may like to store about your email recipient. To be used as a personalization in your email 
extra3StringAny extra information that you may like to store about your email recipient. To be used as a personalization in your email 
extra4StringAny extra information that you may like to store about your email recipient. To be used as a personalization in your email 
extra5StringAny extra information that you may like to store about your email recipient. To be used as a personalization in your email 
extra6StringAny extra information that you may like to store about your email recipient. To be used as a personalization in your email 
trackOpensIntSet flag 1 to enable opens tracking, 0 (default) for no tracking. 
trackClicksIntSet flag 1 to enable clicks tracking, 0 (default) for no tracking. 
customFieldStringCustomized text for your internal tracking. 

Return value

TypeTypeDescription
codeStringThe Success or Error response code as returned by the API. Please refer to the section “Possible-Response-Codes” for more details. 
statusStringDescription of the error code returned. 
transactionIdStringA number generated by the API to uniquely identify the current call. 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",
    "email":"sales@nichelive.com",
                 "mailerID":"2"
}' https://api2.juvlon.com/v4/sendMailer
# Copy & run this in your Ruby terminal.

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

uri = URI('https://api2.juvlon.com/v4/sendMailer')
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
  request = 'application/json')
  request.body = {"apiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
                "mailerID":"2",
                   "email":"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/sendMailer"
data = {"apiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
          "mailerID":"2",
            "email":"sales@nichelive.com"<}
data_json = json.dumps(data)
r = requests.post(url, data=data_json)

print(r)
# Try running locally.
 

$url = 'https://api2.juvlon.com/v4/sendMailer';
$data = '{"apiKey":"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY",
            "mailerID":"2",
            "email":"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\"" + 
                         ",\"mailerID\":\"2\"" +
                                           ",\"email\":\"sales@nichelive.com\""+ 
                                           "}";
System.out.println(POST_PARAMS);
URL obj = new URL("https://api2.juvlon.com/v4/sendMailer");
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/sendMailer";
    HttpWebRequest myHttpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
    myHttpWebRequest.Method = "POST";
    string postData = "{\"apiKey\":\"INSERT_YOUR_JUVLON_ACCOUNT_API_KEY\"" + 
                       ",\"email\":\"sales@nichelive.com\"" +
                          ",\"mailerID\":\"2\"}";

    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();

Success-Response

                                
HTTP/1.1
  {
     "code":200,
     "status":"Success",
     "transactionId":327
  }

                            

Error-Response

HTTP/1.1
{
"code":442,
"status":"Error"
} 

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
448    Your Juvlon account is Deactivated
602    Error: No subscriber provided
454    Error: Subscriber does not exist
412    Error: Invalid recipient email address
414    Error: Sender Domain Blacklisted
416    Error: Recipient Email Domain blacklisted
417    Bounced
418    Delivered
443    Error:INACTIVE Subscriber
444    Low Subscriber credit
445    Low Email credit
451    Opened
452    Clicked
478    Error: from or fromName not provided.