Send fax

  • Thread starter Thread starter Mircea Pleteriu
  • Start date Start date
M

Mircea Pleteriu

Does anybody know how to send a fax from c#.
Is there any suppport for sending faxes?

Thanks
 
Hi,

If you don't mind doing COM Interop you can leverage the fax service in
Windows 2000/XP. You start by adding a COM reference to FAXCOM.DLL (usually
under C:\WINNT\SYSTEM32), then create two objects: FaxServer and FaxDoc.

You use the FaxServer object to connect to your server, and then create
FaxDoc object passing the document you want to fax. At this point you set
the number to dial, send the fax, and disconnect from the server.

You can find the Fax Service Extended COM API documentation here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fax/faxabout_699l.asp

Gabriele
 
Hi,

This is my code:

FAXCOMLib.FaxServerClass fxsvr = new FAXCOMLib.FaxServerClass();

FAXCOMLib.FaxDocClass fxdoc;



try

{

fxsvr.Connect(""); // null for local fax server otherwise a computername

fxdoc = (FAXCOMLib.FaxDocClass)fxsvr.CreateDocument(@"c:\test.txt");

fxdoc.FaxNumber = "0269446970";

fxdoc.Send();

fxsvr.Disconnect();

}

catch (Exception ex )

{

Console.WriteLine( ex.ToString());

}

But the call of fxsvr.Connect("") throws an

System.Runtime.InteropServices.COMException exception and the message is "Unspecified error"

Do you know why that?
 
Back
Top