C# Fax - Sending a Plain-Text File Using SendCharFax

25 Nov 2016 This code sample is deprecated and in process of being removed. Check out our new code libraries and usage documentation on InterFAX @ Github.
Download the C# fax API zip file.

In this sample, you learn how to perform a simple transmission of a fax with C#, using the inbound Web service's SendCharFax method.

Within the downloaded project files you will find this C# fax snippet, which handles the fax transmission, using SendCharFax:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SendCharFax
{
    class Program
    {
        static void Main(string[] args)
        {
            string username = "";
            string password = "";
            string faxnumber = "00442071499926";
            string faxcontents = "Test Fax from InterFAX Web Service.";
            interfax.InterFax interfaxWebServiceOutbound = new interfax.InterFax();
            long resultStatus = interfaxWebServiceOutbound.SendCharFax(username, password, faxnumber, faxcontents, "txt");
            // the file submitted will always be a txt
            if (resultStatus > 0) // if the result is positive, it's the TransactionID created
            {
                Console.WriteLine(string.Format("Created Fax with TransactionID {0}.", resultStatus));
            }
            else // if the result is negative, it's an error code
            {
                Console.WriteLine(string.Format("Failed with Error Code {0}.", resultStatus));
            }
            Console.ReadLine(); // use this to keep console open (waiting for keypress) after it is finished
        }
    }
}

Contact us today

Talk to a member of our team about the benefits InterFAX can bring to your organization's communications processes.

Contact us today