Sending Fax using c# and .NET

Developing WinForms application with VS 2005 to programmatically
fax a document.

You could use fax service API to send fax in your application. Here is the
starting point for the Fax APIs:

First, there are no real samples in MSDN showing how to using the Fax
interfaces from a Managed language.  The Fax documentation existed before
C# or VB.Net existed. However, using Fax from C# or VB.Net is very similar
to doing it from VB.  You need to add a reference to the FaxComEx object
within the Visual Studio IDE and then reference the FAXCOMEXLib namespace.

Next, there are several programmatic interfaces to the Fax Service.  There
is a “C” style API and two different COM interfaces. I strongly recommend
that you use FaxComEx, which is the most recent and by far the most robust
version.  However, this is only supported on Windows XP and later.  If you
must have support for Windows 2000, then you should investigate the FaxCom
interfaces.  Here are some links that discuss the different options.

The following link provide a VB code example of sending a fax.

I think it might help more to introduce the following link to you, which
discusses “COM Interop from VB.NET”.

I also found some VB.NET and C# code samples as follows.

Sample Code :

using FAXCOMLib;
using FAXCOMEXLib;

FaxServerClass fs = new FaxServerClass();
fs.Connect(“<your_computer_name>”); //specifies the machinename
object obj = fs.CreateDocument(“<your_filename>”);
FaxDoc fd = (FaxDoc)obj;
fd.FaxNumber = “<your_fax_number_to_send_to”;
fd.RecipientName = “<your_recipients_name”;
int i = fd.Send();


Windows fax service will install without a fax modem installed in the computer.

But the above code will Fail with a “Unknown Interop Error” if you have no modem installed. The only way I could get it to work is by installing a modem.


One thought on “Sending Fax using c# and .NET

  1. Hi,
    I have tried the above code. But in compile time I am geeting same errors in several places. In my system I am having a simple USB modem.
    Please help.

    The error are:
    Error 2 Interop type ‘FAXCOMEXLib.FaxRecipientsClass’ cannot be embedded. Use the applicable interface instead.

    The Code is:
    private int FaxDocument(String TheFile, string faxnumber)
    int JobID=0;
    FAXCOMEXLib.FaxRecipients frs = new FAXCOMEXLib.FaxRecipientsClass();
    FAXCOMEXLib.FaxDocument faxdoc = new FAXCOMEXLib.FaxDocumentClass();
    FAXCOMEXLib.FaxServer faxsrv = new FAXCOMEXLib.FaxServerClass();
    faxdoc.Body = TheFile;
    faxdoc.DocumentName = “Fax Transmission”;
    faxdoc.ReceiptAddress = “”;

    frs.Add(faxnumber, “John Doe”);
    faxdoc.Recipients.Add(faxnumber, “PH”);

    return JobID;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s