Beispiel #1
0
        static void Main(string[] args)
        {
            long userID = api.AuthenticateUser("*****@*****.**", "*****@*****.**");

            string[] trackLabels = new string[1];
            trackLabels[0] = "tracking label";
            string[] trackValues = new string[1];
            trackValues[0] = "tracking key";
            string[] recpNames = new string[1];
            recpNames[0] = "test recp";
            string[] recpAddresses = new string[1];
            recpAddresses[0] = "+17208704141";
            bool[] recpRawFax = new bool[1];
            recpRawFax[0] = false;
            string[] docName = new string[1];
            docName[0] = "pdf-sample.pdf";
            object[] docBytes = new object[1];
            docBytes[0] = File.ReadAllBytes(@"C:\pdf-sample.pdf");
            bool[] isMerge = new bool[1];
            isMerge[0] = false;

            var results = api.SendMessage(userID, "Peter", "Engie", "Test Fax", "Test Note", trackLabels, trackValues, recpNames, recpAddresses, recpRawFax, docName, docBytes, isMerge);
            var status  = api.GetMessageStatus(results);

            System.Threading.Thread.Sleep(10);
            Console.WriteLine(status);
            Console.ReadLine();
        }
Beispiel #2
0
        private string SendFax(wfApi api, Int64 uid, string senderName, string subject, string recipientNameValue, string recipientFaxNumber, string filename)
        {
            var trackingKey   = new string[2];
            var trackingValue = new string[2];

            trackingKey[0]   = "Tracking Key 1";
            trackingValue[0] = "";
            trackingKey[1]   = "Tracking Key 2";
            trackingValue[1] = "";
            //recipient information. sample below shows how to insert one recipient to the message.
            //to send to multiple fax recipients, just extend the list for information below.
            //recipient notify address, notification on send success and notification on send fail are optional.
            var recipientName                = new string[1];
            var recipientCompany             = new string[1];
            var recipientFax                 = new string[1]; //recipient fax number
            var isRawFax                     = new bool[1];   //specify fax number as raw format
            var recipientNotifyAddress       = new string[1]; //recipient email notification address
            var notifyRecipientOnSendSuccess = new bool[1];   //notify recipient on message send success
            var notifyRecipientOnSendFail    = new bool[1];   //notify recipient on message send fail

            recipientName[0]    = recipientNameValue;
            recipientCompany[0] = "";
            recipientFax[0]     = recipientFaxNumber;
            isRawFax[0]         = true;
            //recipientNotifyAddress[0] = "*****@*****.**";
            recipientNotifyAddress[0]       = "";
            notifyRecipientOnSendSuccess[0] = true;
            notifyRecipientOnSendFail[0]    = true;

            //attachment information

            FileStream fs = null;

            byte[] doc1;
            try
            {
                fs   = File.OpenRead(filename);
                doc1 = new byte[fs.Length];
                fs.Read(doc1, 0, Convert.ToInt32(fs.Length));
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }
            }


            //attach document from Bytes/Upload (multiple documents)
            var documentName    = new string[1];
            var documentPath    = new string[1];
            var documentBytes   = new object[1];
            var isMergeDocument = new bool[1];

            documentName[0]    = Path.GetFileName(filename);
            documentPath[0]    = string.Empty;
            documentBytes[0]   = doc1;
            isMergeDocument[0] = false;

            var result = api.SendMessage(uid
                                         , senderName
                                         , ""
                                         , subject
                                         , ""
                                         , ""
                                         , ""
                                         , 50
                                         , false
                                         , false
                                         , false
                                         , trackingKey
                                         , trackingValue
                                         , recipientName
                                         , recipientCompany
                                         , recipientFax
                                         , isRawFax
                                         , recipientNotifyAddress
                                         , notifyRecipientOnSendFail
                                         , notifyRecipientOnSendSuccess
                                         , documentName
                                         , documentPath
                                         , documentBytes
                                         , isMergeDocument);

            return(result);
        }