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

sendAttachmentMailer

Description

Adds an attachment to an existing email in your Juvlon account and sends it to an email address. 

The file to be used as an attachment must be provided in the API call. This file will be attached to the specified email (already existing in your Juvlon account) before sending it out to your subscriber.

Please note:

  • The specified attachment is only used in the current sending. It is not added to the email in your Juvlon account, and thus will not be sent as attachments in subsequent sendings from the UI or using APIs. Hence, this API is perfect for sending out personalized attachments.
  • Any attachment that the email may already have (set in your Juvlon account) will be ignored for this sending. 

The following types of files are allowed for sending out as attachments:

  • .pdf
  • .doc, .docx
  • .xls, .xlsx

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/sendAttachmentMailer

Json Parameter - '{"apiKey":"$apiKey",
              "mailerID":"$mailerID",
              "attachmentFileName":"$attachmentFileName",
              "attachmentContent":"$attachmentContent",
              "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",
              "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. 
mailerIDIntMandatory. The message ID of the already created email in your Juvlon account that you would like to send. 
attachmentFileNameStringMandatory.  The filename to be set for the attachment. 
attachmentContentStringMandatory. Base64-encoded content of the file to be attached to the email. 
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 
customFieldStringCustomized text for your internal tracking. 
    

Return values

NameTypeDescription
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)

PHP Example Code for Integration

$url = 'https://api2.juvlon.com/v4/sendAttachmentMailer';

$data = '{"apiKey":"KEY",
          "mailerID":"28",
          "attachmentFileName":"TestAttachment.txt",
          "attachmentContent": "VGhpcyBpcyBhIHRlc3QgYXR0YWNobWVudCBzZW50IHZpYSBKdXZsb24gQVBJLg==",
          "subID":"98",
          "email":"example@abc.com",
          "mobile":"9890999999",
          "listName":"ListABC",
          "prefix":"Mr.",
          "firstName":"John",
          "middleName":"K",
          "lastName":"Smith",
          "phone":"+91227492682648",
          "address":"House 5, Suncity",
          "city":"Mumbai",
          "state":"Maharashtra",
          "pinCode":"9604",
          "country":"India",
          "residencePhone":"912274926829",
          "designation":"Project Manager",
          "company":"XYZ ltd.",
          "companyAddress":"Office no 5, ABC IT Park",
          "companyCity":"Mumbai",
          "companyState":"Maharashtra",
          "companyCountry":"India",
          "companyPin":"9607",
          "companyPhone":"+912274926826",
          "companyFax":"+912274926827",
          "birthday":"1988-06-10",
          "anniversary":"2015-06-11",
          "referenceNo":"123",
          "extra1":"98732",
          "extra2":"989",
          "extra3":"7687",
          "extra4":"989",
          "extra5":"7687",
          "extra6":"K987JF",
          "customField":"custom_text"
          }'; 
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$res1 = curl_exec($ch);
curl_close($ch);

Success-Response

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

Error-Response

HTTP/1.1
  {
     "code":403,
     "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
456    Error: Invalid Subscriber ID
457    Error: Subscriber ID does not exist
412    Error: Invalid recipient email address
408    Error: HTML content not provided for email
413    Error: Blacklisted domain in the HTML
414    Error: Sender Domain Blacklisted
415    Error: Reply-to domain blacklisted
416    Error: Recipient Email Domain blacklisted
417    Bounced
418    Delivered
421    Error: Sender not activated
455    Error: Invalid recipient mobile number
422    Error: Invalid date provided for Birthday
423    Error: Invalid date provided for Anniversary
426    Error: Mailer ID does not exist in your Juvlon account
430    Error: Mailer ID provided is not an email
441    Error: Invalid list name
443    Error:INACTIVE Subscriber
444    Low Subscriber credit
445    Low Email credit
451    Opened
452    Clicked
465    Error: Attachment type not allowed
466    Error: Attachment not enabled in your account
467    Error: Exceeded the maximum attachment size for your account
468    Error: Attachment Name not Provided