Zeptomail API (PHP) with invoice pdf attachment

Zeptomail API (PHP) with invoice pdf attachment

I am unable to properly make the syntax of API request via PHP to sent order invoice (PDF) in attachment. 

Below is my sample code API request - 
  1. $file = '169242759486.pdf';
  2. $attFile = 'https://www.example.com/secureInvoice/' . $file;
  3. $base64_attFile = chunk_split(base64_encode(file_get_contents($attFile)));
  4. "from": { "address": "sender@email.com", "name": "Sender Name"},
  5. "to": [{"email_address": {"address": "customer@email.com","name": "Customer Name"}}],
  6. "reply_to": {"address": "user@email.com", "name": "User Name"},
  7. "subject":"Test Email",
  8. "attachments": { "content": "'.$base64_attFile.' ", "mime_type": "application/pdf", "name": "myinvoice.pdf"},
  9. "htmlbody":"<div><b> Test email sent successfully. </b></div>",
  10. }'

I am getting the error response as - 

  1. {"error":{"code":"TM_3301","details":[{"code":"SM_101","message":"Invalid value format","target":"attachments"}],"message":"Bad Syntax"}}

Anybody kindly help me to fix it. 

      • Sticky Posts

      • TransMail Overview

        Note: TransMail is now ZeptoMail. Click here to know more. Hey there! It's been 5 months since we launched Zoho's transactional email service — TransMail. We've had great response and onboarded many users. I'd like to now give an overview of TransMail
      • TransMail has a new name—ZeptoMail!

        Tried navigating to TransMail's community forum but see a different name now? That's because TransMail has a new name. TransMail is now ZeptoMail! As we’ve grown from an internal service used mainly by other Zoho products to an up-and-coming competitor
      • Welcome to TransMail community

        Note: TransMail is now ZeptoMail. Click here to know more. Hi everyone, Welcome to TransMail's community forum. Though TransMail has been in use inside Zoho for nearly half a decade, we only recently launched it as a service to all of you. We'd firstly