How to send fax using VB.net

asp.net , vb.net United States
  • 9 years ago

    Hi All,


    I caught the error while running the following code in VB.net 1.1 on my XP.


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


           Try
               Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
               Dim objFaxServer As New FAXCOMEXLib.FaxServer
               Dim objSender As FaxSender
               Dim JobID As Object


               objFaxServer.Connect("LAB1-STU15")
               objFaxDocument.Body = "c:\Test.txt"
               objFaxDocument.DocumentName = "My First Fax"
               objFaxDocument.Recipients.Add("94114619774", "Bud")
               objFaxDocument.AttachFaxToReceipt = True
               objFaxDocument.Note = "Here is the info you requested"
               objFaxDocument.Subject = "Today's fax"
               JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
               MsgBox("The Job ID is :" & JobID(0))


           Catch ex As Exception
               MsgBox("Error number: " & Hex(Err.Number) & ", " & Err.Description)
           End Try
       End Sub



    It gives me foloowing error.


    "Error number: 800710D8, Operation failed."


    I double check all the variables. But those are correct. File is there.
    The exception is  System.Runtime.InteropServices.Exception.


    I don't know what to do.
    I prefer if somebody can help me to solve the problem.
    Pls reply me ASAP.  Since I have to show this project  19th of September.


    Cheers,
    Gayan


  • 9 years ago

    Install a fax printer to send a fax. You need to install a FAX printer before executing this operation on your computer to avoid this error.




    GMIke    


    "I would love to change the world, but they won't give me the source code."


    Enjoy: http://www.developerfusion.co.uk/forums/topic-29704

  • 9 years ago

    Hi GMike,


    Sorry for late reply.
    Yesterday night I have tried it and it works fine.
    Thanks a lot.
    I also read your funny thread.


    Cheers,
    Gayan


  • 9 years ago

    Hi GMike and All,


    As I told you my fax works fine.
    But since I want to enhance the application I used this code for the asp.net web project.
    I checked it with .txt file and it works fiine.
    But when I try to send .doc file it doen't get faxed.
    I put a breakpoint and checked it. Code didn't execute after ConnectedSubmit method.
    It doesn't gave me any error as well. But it tooks lot time but nothing happens.
    I again try with .txt file which is 1kb size. It works fine.
    But for the .doc file which is 20kb file it took lot time. But nothing happens.


    FOr VB.net application it works for both .txt and .doc file.
    So what should I do to get rid of this problem.
    Time is ticking. I need help very ASAP.


    Best Regards,
    Gayan

  • 9 years ago
    Try to set the priority of FaxDocument to Highest, may be this will work although not tested.
    Code:

    objFaxDocument.Priority = fptHIGH
    objFaxServer.Connect("LAB1-STU15")
    objFaxDocument.Body = "c:\abc.doc"



    GMike    

    "I would love to change the world, but they won't give me the source code."  
  • 8 years ago

    Hi ,

    I have the same problem. When I try to send a FAX, it works fine on my local WinXP machime, but when I try on my Win2003 server it doesn't work. Windows fax service is installed on both. There are no differences between the configs.

    I can connect to the sever, list the jobs and much more, but when I try to send a Fax using

    "ConnectedSubmit(faxServer)"

    I get an Exception with the error code "800710D8".

    It's weird, because I can acces all the jobs but can't send a Fax.

    Any idea?

    Thanks!

    Here is my code:

     

     

    Dim objFaxDocument As New FAXCOMEXLib.FaxDocument

    Dim objFaxServer As New FAXCOMEXLib.FaxServer

    Dim objSender As FAXCOMEXLib.FaxSender

    Dim JobID As Object

    Dim devices As FAXCOMEXLib.FaxDevices

    Dim device As FAXCOMEXLib.FaxDevice

    'Error handling

    On Error GoTo Error_Handler

    'Connect to the fax server

    'This doesn't work... :-(

    objFaxServer.Connect("MyFaxServer")

    'This works fine!

    objFaxServer.Connect("")

    'Set the fax body

    objFaxDocument.Body = "C:\test.txt"

    'Name the document

    objFaxDocument.DocumentName = "My First Fax"

    'Set the fax priority

    objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH

    'Add the recipient with the fax number 12225550100

    objFaxDocument.Recipients.Add("4893310", "Bud")

    'Choose to attach the fax to the fax receipt

    objFaxDocument.AttachFaxToReceipt =

    True

    'Set the cover page type and the path to the cover page

    objFaxDocument.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptNONE

    'objFaxDocument.CoverPageType.FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptNONE()

    objFaxDocument.CoverPage = "generic"

    'Provide the cover page note

    objFaxDocument.Note = "Here is the info you requested"

    'Provide the address for the fax receipt

    objFaxDocument.ReceiptAddress = ""

    'Set the receipt type to email

    objFaxDocument.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMSGBOX

    'Specify that the fax is to be sent at a particular time

    objFaxDocument.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstNOW

    ' FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstSPECIFIC_TIME

    'CDate converts the time to the Date data type

    'objFaxDocument.ScheduleTime = (CDate("4:35:47 PM"))

    objFaxDocument.Subject = "Today's fax"

    'Set the sender properties.

    objFaxDocument.Sender.Title = "Mr."

    objFaxDocument.Sender.Name = "Bob"

    objFaxDocument.Sender.City = "Cleveland Heights"

    objFaxDocument.Sender.State = "Ohio"

    objFaxDocument.Sender.Company = "Microsoft"

    objFaxDocument.Sender.Country = "USA"

    objFaxDocument.Sender.Email = "someone@microsoft.com"

    objFaxDocument.Sender.FaxNumber = "12165555554"

    objFaxDocument.Sender.HomePhone = "12165555555"

    objFaxDocument.Sender.OfficeLocation = "Downtown"

    objFaxDocument.Sender.OfficePhone = "12165555553"

    objFaxDocument.Sender.StreetAddress = "123 Main Street"

    objFaxDocument.Sender.TSID = "Office fax machine"

    objFaxDocument.Sender.ZipCode = "44118"

    objFaxDocument.Sender.BillingCode = "23A54"

    objFaxDocument.Sender.Department = "Accts Payable"

     

    'Save sender information as default

    objFaxDocument.Sender.SaveDefaultSender()

    'Submit the document to the connected fax server

    'and get back the job ID.

    JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

    MsgBox("The Job ID is :" & JobID(0))

    Exit Sub

    Error_Handler:

    'Implement error handling at the end of your subroutine. This implementation is for demonstration purposes

    MsgBox("Error number: " & Hex(Err.Number) & ", " & Err.Description)

  • 8 years ago

    I receive error: 800710D8.  After searching the error on Google, I found out that the error means that the fax printer isn't installed on the client machine.


    The network fax that is installed on my PC (Win XP Pro SP2) is the fax modem on the server.  The fax icon in "Printers and Faxes" is a MS Shared Fax Driver and clicking on opens up Fax Console.  So I should be able to send a fax through the vb code and that fax should appear in the Fax Console.


    If I have a MS Fax Shared Driver installed then why the error?   Any suggestions on how to resolve the error?

    Thanks.

  • 8 years ago

    can you tell me what refrences you added to your project to make these command lines work

       Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
               Dim objFaxServer As New FAXCOMEXLib.FaxServer
               Dim objSender As FaxSender
               Dim JobID As Object

    i need to send a .doc via a fax with a fax printer








  • 8 years ago

    Main reference you need to install is "MS Fax Service Extended COM Library".  Any idea on the error that I mentioned above?

  • 8 years ago

    only thing i can think of is that they dont have access to your computer or the printer that you are using isnt really set up as  a fax printer

  • 8 years ago

    I am having problem in a somewhat different scenario, which is mentioned below:

    -------------------------------------------------------------------------------------

    "Adobe Reader --
     Faxing a pdf document

    My Dot net(C#) based application sends fax messages. I am using FAXCOMLIB.DLL version=1.0.0.0 (Microsoft's dll used for faxing) and runtime version=v1.1.4322 for sending the fax message. When the application attaches a PDF Document and sends the Fax message, an Adobe Acrobat reader instance gets opened in a minimized state.This happens whenever the application sends a fax message with PDF Document attached, a new instance of Acrobat reader gets opened everytime (in a minimized state) and neither of them closes on completion of sending the Fax message. We have to close all those opened instances of Acrobat Reader manually. This however does not happen while faxing Microsoft word documents.








    I am using the following code:

    --------------------------------

    public

    bool SendFax(string pstrSubject, string pstrMsgFileName,string pstrPDFFileName,

    string pstrUserName, string pstrFaxNumber,string pstrFaxServerName)

    {

    bool bIsService=FaxServiceCheck();

    if(pstrFaxServerName=="(local)")

    {

    pstrFaxServerName=Environment.MachineName;

    }

    FAXCOMLib.FaxServer faxServer =

    new FAXCOMLib.FaxServerClass();

    try

    {

    faxServer.Connect(pstrFaxServerName);

    }

    catch

    {

    MessageBox.Show("Unable to connect the Fax Server, Please make sure the Fax Service is Running.");

    }

    FAXCOMLib.FaxDoc faxDoc1 = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(pstrPDFFileName);

    FAXCOMLib.FaxDoc faxDoc2=(FAXCOMLib.FaxDoc) faxServer.CreateDocument(pstrMsgFileName);

    faxDoc1.RecipientName = pstrUserName;

    faxDoc1.FaxNumber = pstrFaxNumber;

    faxDoc1.DisplayName = "Caravan Messaging System";

    faxDoc2.RecipientName = pstrUserName;

    faxDoc2.FaxNumber = pstrFaxNumber;

    faxDoc2.DisplayName = "Caravan Messaging System";

    try

    {

    int Response = faxDoc1.Send();

    faxServer.Disconnect();

    }

    catch

    {

    }

    try

    {

    int Response = faxDoc2.Send();

    return true;

    }

    catch

    {

    return false;

    }

    }


    If someone can suggest a workaround for this, please advice. "

  • 8 years ago

    Hey did you get the this problem resolved?  I am having the same issue. I can fax the ms word document by printing it to the remote fax server but it does not work from the Visual Basic Code. It fails on ConnectedSubmit(objFaxServer) returning "800710D8"

    Can you please share the fix?

    Thank you...

  • 7 years ago

    Hi dear,

    can u tell me that where i found the dll for FAXCOMEXLib ?

    and that file is work in windows 2000 or not?

    Please tell immediatly i need it.

    Thanks

     

  • 7 years ago

    hi,

     you can find the FAXCOMEX.DLL in windows 2003/SBS server.

  • 7 years ago

    Hi!

    I'm working with the FAXCOMlib library to implement a fax aplication for sending and receiving faxes and I need to get the image that the Windows Fax Machine generates into a temporal folder.

    What can I do to reference the image with the FaxTiff object?

     

    Thank you very much for any information.

  • 7 years ago
    Any information about the faxcomlib faxtiff library?

    Thanks.



  • 7 years ago
       
    Hi All,

    I have read through the previous messages in the this thread relating to the use of VB.Net to send fax, however I would like to know if it is possible to send fax with VB6 and how can I do this? preferably without major cost implications. Can some please give me an example of the code that may be required.

    Thanks,

    Chirag.








  • 6 years ago
    Hi, Thanks for your code. I was searching code and i find it in Developerfusion site. Its working fine. I need some more help. Can you tell me how to send bulk fax. I have data like Fax no. and recipient name in data grid now i want to send the fax using for loop for all the data. Thanks in advance Enjoy Programming Medha.net
  • 3 years ago

    i am currently having my internship training at an IT company.my supervisor had ask me to create a solution for a fax integration. i was told to code a coding that can verify a fax number in a .txt file(it can be one fax number or many), then it will trigger another program (he asked me to download an open source software) to send faxes to the recipients (the fax number verified before). thruthfully,i have no idea how to do this. anyone can help me, at least what software can be best used and how the flow of this assignment should be. as for verifying the fax number, i am using simple java code with Luhn algorithm, but i ABSOLUTELY have no idea hot to integrate it with other (existing or newly created by me) software to send faxes..any help will be much appreciated..thanks.

  • 3 years ago

    Hi all,

    Following this interesting discussion, there's a page that might be of help, which documents common FAXCOMEXLib problems and solutions (InterFax site), and collects similar issues and links to discussions on major developer forums.

  • 3 years ago

    Hi,

    Thanks a lot, It's nice post my work.

    Daniel

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup