Base64Encode

CAS XML Script Library

The Base64Encode function converts a BSTR to base64 format and returns the output data as a BSTR that is compatible with XML.

This function is provided in script for applications that cannot use ActiveX controls. If the FaxBackX ActiveX control is installed, Base64Encode will automatically use the faster FaxBackX method, base64_encode, to perform the conversion.

BSTR Base64Encode(
  BSTR InputData // Data to encode
)


Parameters:
InputData Data to encode in base64. A BSTR can contain binary data.

Return Value:
Base64 encoded version of input data.

Example:
function SendCoverText( CoverText, SubjectText )
  {
  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",2);  // Cover Message
    xmlTlAddTag(Tl,"CONTENT_TYPE",1);       // File Type ASCII
    xmlTlAddTag(Tl,"CONTENT_DATA",Base64Encode(CoverText));
  xmlTlCloseSection(Tl);

  xmlTlCreateSection(Tl,"CUSTOM_SECTION",null);
    xmlTlAddTag(Tl,"EMAIL_SENT",0);
    xmlTlAddTag(Tl,"SUBJECT",SubjectText);
  xmlTlCloseSection(Tl);
      
  var responseXML = xmlTlSend(Tl,
                              "\\\\FAX\\NETSAT",
                              "NETSAT",
                              2,
                              "http://netsat/casxml.asp");
    
  return (xmlTlGetTag(responseXML,"STATUS_NUM"));
  }
See Also:
xmlTlNew, xmlTlAddTag, xmlTlSend, Base64Decode