Below is the code I use to send the fax. It works 60% of the time. When it doesn't work, I get an error from Right Fax that says "Problem Converting Fax Body or Cover Sheet" with the data "Error 2 occurred while trying to load the images for the fax. The system cannot find the file specified." The files I attach are left on the drive for an hour after faxing. They all open properly. All of the faxes include one text file and one pdf. All of them are identical in my testing, but only 60% are sent and 40% return this error...
I have tried adding thread.sleep calls in various places, but even with sleep times of 10 seconds after attaching and after sending, the error occurs.
Here is my code...
RFXServ.OpenServer()
RFXDoc = RFXServ.CreateObject(RFCOM
APILib.Cre
ateObjectT
ype.coFax)
With RFXDoc
'Populate the basic data... we already know that we have a non-null fax number,
'so no need to check again...
.ToFaxNumber = dr.FaxNumber
With RFXServ.AuthorizationUser
'Effectively, we do not want any feedback coming back from the fax server telling
'us anything about the sending status...
.SendNotifyOnIncompleteFir
stTime = False
.SendNotifyOnIncompletePer
iodically = False
.SendNotifyOnNoHoldForPrev
iew = False
.SendNotifyOnSendFailedWil
lRetry = False
.SendNotifyOnSendFailure = False
.SendNotifyOnSendHeldForAp
proval = False
.SendNotifyOnSendingFirstT
ime = False
.SendNotifyOnSendFailure = False
.SendNotifyOnSendingPeriod
ically = False
.SendNotifyOnSentSuccessfu
lly = False
End With
If dr.IsFaxToNameNull = False Then
.ToName = dr.FaxToName
End If
If dr.IsFaxFromNameNull = False Then
.FromName = dr.FaxFromName
End If
For Each tblDocumentsToIncludeRow In mr.GetChildRows("MessageDo
cumentsToI
nclude")
'This line attaches the document to the fax... we do not delete on sending
'because we may send to multiple recipients.
.Attachments.Add(tblDocume
ntsToInclu
deRow.Docu
mentName, RFCOMAPILib.BoolType.False
)
Thread.Sleep(cGeneralParam
etersRow.S
leepMilise
condsAfter
Faxing)
Next
.Send()
'We need to give the fax server time to pickup and convert the documents before we delete them...
Thread.Sleep(cGeneralParam
etersRow.S
leepMilise
condsAfter
Faxing)
RFXServ.CloseServer()
End With
Return True
Start Free Trial