send fax with C# and FAXCOMLIb
-
27-10-2019 - |
Question
I am working on a project to send 2 files with fax several times. this is my code :
public static bool SendFax(string Recipient, string Number, params string[] Files)
{
FaxServer server = new FaxServerClass();
try
{
server.Connect(Environment.MachineName);
for (int i = 0; i < Files.Length; i++)
{
FaxDoc faxDoc = (FaxDoc)server.CreateDocument(Files[i]);
faxDoc.RecipientName = Recipient;
faxDoc.FaxNumber = Number;
faxDoc.Send().ToString();
}
return true;
}
catch
{
return false;
}
finally
{
server.Disconnect();
}
}
I have a grid, When user click on a button , i call this method for each row of grid. Problem is here , I want remove each row ,if fax set successfully , but how i can find out my fax sent correctly or not ?
thanks
More Info :
Working with VS 2010 , Windows App , C#
Solution
After faxDoc.Send()
fax is not sent immediately, but it is put into faxqueue instead. Here is an article how you can check status of your fax message in a faxqueue (It is VB.NET, but you will have no problems converting it into C#). Call that method periodically until it is sent.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow