public void SendFax(string DocumentName,
string FileName, string RecipientName, string FaxNumber)
{
if (FaxNumber != "")
{
try
{
FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
faxServer.Connect(Environment.MachineName); FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);
faxDoc.RecipientName = RecipientName;
faxDoc.FaxNumber = FaxNumber;
faxDoc.DisplayName = DocumentName;
int Response = faxDoc.Send();
faxServer.Disconnect();
}
catch(Exception Ex){MessageBox.Show(Ex.Message);}
}
}
为了在工程中引用faxcom 1.0 Type Library,必须首先安装Windows Component 中的Fax services。