0
votes

I am trying to write some code that sends a fax from my computer, I am using VB.NET desktop application..

Here is my code

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 FAXCOMEXLib.FaxSender = Nothing
        Dim JobID As Object

        objFaxServer.Connect("")
        objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH
        objFaxDocument.Body = "c:\invoice.txt"
        objFaxDocument.DocumentName = "My First Fax"
        objFaxDocument.Recipients.Add(stringPhoneNumber, "the man with the money")
        objFaxDocument.AttachFaxToReceipt = True

        objFaxDocument.Note = "first text fax of the day in vb"

        objFaxDocument.Subject = "testing fax system in vb"

        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

Now, when I press the button, the code runs without problems, and I get the jobID, but the fax is not received in my recipient fax machine.

I have a fax modem in the computer, and I connected the computer with the phone line. I send the fax to another line connected with fax machine. My computer runs windows 7 ultimate (64-bit).

1

1 Answers

0
votes

First check Windows Service Fax is running.

Then maybe some more data on properties will help.

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 FAXCOMEXLib.FaxSender = Nothing
    Dim JobID As Object

    objFaxServer.Connect("")
    objFaxServer.Folders.OutgoingQueue.Retries = 0  
    objFaxServer.Folders.OutgoingQueue.Save() 
    objFaxServer.ListenToServerEvents(FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE)


    objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH
    objFaxDocument.Body = "c:\invoice.txt"
    objFaxDocument.DocumentName = "My First Fax"
    objFaxDocument.Recipients.Add(stringPhoneNumber, "the man with the money")
    objFaxDocument.AttachFaxToReceipt = True

    objFaxDocument.Note = "first text fax of the day in vb"

    objFaxDocument.Subject = "testing fax system in vb"
    objFaxDocument.ScheduleType = FAXCOMEXLib.FAX_SCHEDULE_TYPE_ENUM.fstNOW 

    objFaxDocument.Sender.Name= "John Doe"
    objFaxDocument.Sender.FaxNumber= "John Doe number"
    objFaxDocument.Sender.Title= "My Fax"

    objFaxDocument.CoverPage = "Generic"
    objFaxDocument.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptNONE
    objFaxDocument.Note = "Text message"
    objFaxDocument.Sender.SaveDefaultsender()

    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