CONTENT_DATA

CAS Tags

The CONTENT_DATA string tag is used in taglists prepared for the SEND_MESSAGE function to provide ASCII or Rich Text content to be merged into a fax cover page. If a cover template is not specified for the NET SatisFAXtion user sending the message, the content will be rendered as-is for the cover.  If a cover template is defined, the content of this tag will be merged into the cover template's $(Cover) placeholder.

The CONTENT_DATA tag must be a member of a CONTENT_PART section within the SEND_MESSAGE taglist.  The CONTENT_TYPE tag must be set to 1 (ASCII) or 8 (RTF) and the CONTENT_PART tag set to 2 (COVER_TEXT) for this tag to be processed properly.  See example below.


XML Interface:
The CONTENT_DATA tag plays an expanded role in the CAS XML Interface.  For every CAS function where the CURRENT_FILESPEC or DESTINATION_FILESPEC tag references a file on the client computer, the CONTENT_DATA tag is used instead. The CONTENT_DATA tag is included in the XML, and contains the content of the file, encoded in base64. For more information, see Working with Files in the CAS XML Interface.

  Type Max Size Multiple Allowed
String N/A One per CONTENT_PART section

Example #1 (ActiveX Interface):
function SendFaxCover()
  {
  var Tl, Sl, StatusNum;
  
  Tl = CAS.New();
  CAS.AddTag(Tl,"SEND_MESSAGE","");
  CAS.AddTag(Tl,"REGISTERED_NAME",UserName);
  CAS.AddTag(Tl,"REGISTERED_PASSWORD",UserPassword);
  CAS.AddTag(Tl,"TRANSFER_TYPE",0);  // 1= EMAIL, 0=FAX
  CAS.AddTag(Tl,"SUBJECT","Subject");

  Sl = CAS.CreateSection(Tl,"RECEIVER_ADDRESS","555-123-1234");
    CAS.AddTag(Sl,"RECEIVER_NAME","Recipient");
  CAS.CloseSection(Sl);
                  
  Sl = CAS.CreateSection(Tl,"CONTENT_PART",2);  // Cover Message
    CAS.AddTag(Sl,"CONTENT_TYPE",1);            // File Type ASCII
    CAS.AddTag(Sl,"CONTENT_DATA","This is my cover text!");
  CAS.CloseSection(Sl);

    // Send message on this already open session
  Tl = CAS.Send(cInst,Tl);
  StatusNum = parseInt(CAS.GetTag(Tl,"STATUS_NUM",0));
  CAS.Delete(Tl);
  
  return(StatusNum);
  }

Example #2 (XML Interface): 
function SendFaxFile( File )
  {
  var Tl = xmlTlNew();
  xmlTlAddTag(Tl,"SEND_MESSAGE",null);
  xmlTlAddTag(Tl,"REGISTERED_NAME","User1");
  xmlTlAddTag(Tl,"REGISTERED_PASSWORD","");
  xmlTlAddTag(Tl,"TRANSFER_TYPE",0);   // 1= EMAIL, 0=FAX

  xmlTlCreateSection(Tl,"RECEIVER_ADDRESS","555-123-4567");
    xmlTlAddTag(Tl,"RECEIVER_NAME","MyRecipient");
  xmlTlCloseSection(Tl);
    
  xmlTlCreateSection(Tl,"CONTENT_PART",3);  // Attachment
    xmlTlAddTag(Tl,"CONTENT_TYPE",0);
    xmlTlAddTag(Tl,"CONTENT_DATA",FBX.base64_encode_from_file(File));
  xmlTlCloseSection(Tl);
      
  var responseXML = xmlTlSend(Tl,Domain,Server,Protocol,ProxyURL);
    
  return(xmlTlGetTag(responseXML,"STATUS_NUM"));
  }
Example #3 (XML Interface): 
function GetMessageFile( MsgHandle, MsgFileName, DestinationFile )
  {
  var Tl = xmlTlNew();
  xmlTlAddTag(Tl,"GET_FILE_FUNCTION",null);
  xmlTlAddTag(Tl,"REGISTERED_NAME",UserName);
  xmlTlAddTag(Tl,"REGISTERED_PASSWORD",UserPassword);
  xmlTlAddTag(Tl,"MESSAGE_HANDLE",MsgHandle);
  xmlTlAddTag(Tl,"CURRENT_FILESPEC",MsgFileName);

  var responseXML = xmlTlSend(Tl,Domain,Server,Protocol,ProxyURL);

  if (xmlTlGetTag(responseXML,"STATUS_NUM") == 0)
    {
      // Extract file from XML and convert from base64

    FBX.base64_decode_to_file(xmlTlGetTag(responseXML,"CONTENT_DATA"),
                              DestinationFile);
    }
  }

See Also:
SEND_MESSAGE, GET_FILE_FUNCTION, CONTENT_TYPE, ORIGINAL_FILENAME, CURRENT_FILESPEC, COPY_ATTACHMENT, TEMPLATE_NAME