views:

148

answers:

2

How do I go about sending fax in .NET? We have a fax server through which we need to fax documents to clients. Since we have a fax server, I don't imagine that I have to configure a fax modem on my machine, right? It would just go through the fax server?

Are there any good free (or cheap) Fax APIs out there? IN my research I've come across FAXCOMEXLib, FaxMan, and Windows Fax Service, but the documentation seems limited, so I am hoping someone here can point me in the right direction.

Thanks!

+1  A: 

Depending on your budget, you may consider a fax to e-mail service instead. Many services have a .NET-compatible API, and reasonable rates.

This is likely to be considerably easier (and therefore, cheaper) than actually interacting with a fax server.

Raskolnikov
Actually this is for a company, and for privacy reasons this is not going to be possible. So, it's really that tough to interact with a fax server? All I want to do is to send some pdfs to the fax server instead of to the printer.
Prabhu
Also, international faxes are likely to be considerably cheaper and more reliable through such a service.
Raskolnikov
I am not necessarily saying it is difficult; I don't know to do this without some research, but it's what I'd do. I'll take your word for it on privacy reasons as I can't know the laws that affect you, but I know many UK businesses that use fax APIs for this purposes, even with confidential documents.
Raskolnikov
Thanks...I'll have to consider this if it comes to it.
Prabhu
Of course, if privacy *really* is an issue, then sending stuff unencrypted over the public telephone network might not be your best option. :-)
Dave Markle
+1  A: 

As far as I know, .NET doesn't have anything built in to directly support sending FAXes via a FAX server. Absent that, you'd probably want to use the COM interface to the fax server. Basically, you create a FaxServer object and invoke its Connect method to connect to the FAX server. You then invoke the FaxServer's CreateDoc method to create a FAX document object. The FaxDoc object has a (huge) number of properties to specify more about the recipient and document than any sane person would imagine, but the two main ones are the FileName and FaxNumber. Once you've set those (along with any others you want) you invoke its Send method to send that document to that fax number.

I last played with this a few years ago, so I'm probably skipping a few things. Mostly I remember that it seemed strange that the FaxServer created a blank FaxDoc that you filled in and then asked to send itself, and that there was a lot of documentation covering "stuff" that initially seemed like it would be necessary, but turned out to be completely irrelevant, at least for what I was doing (and in retrospect, probably usually would be).

Jerry Coffin
Thanks. I actually just tried this (using the FaxComLib) and I get this error "hresult e_fail has been returned from a call to a COM component". After Googling it, it seems like this error is thrown when connecting to a fax server instead of a modem configured on the local machine.
Prabhu
@Prabhu: I was using it with a FAX server, not a local FAX MODEM, so I'm sure it's possible, or at least was. If memory serves, this was an XP client and Win2K3 server. I'm trying to remember -- it vaguely seems like there were actually a couple of different FAX components, only one of which worked. Doing a quick glance on MSDN indicates that there's an "Extended COM Object", which may be the thing to use.
Jerry Coffin
Thanks @Jerry, I'll look into that.
Prabhu