日期:2011-06-19  浏览次数:20458 次

/**//// <summary>
  /// ////发送传真的方法,传递三个参数
  /// </summary>
  /// <param name="faxFile"></param>
  /// <param name="faxNumber"></param>
  /// <param name="hostName"></param>
  public void sendFax(string faxFile ,string faxNumber,string hostName)
  {
  
   //writeFile("sendFax faxFile= "+faxFile);
   string sql = "";
   string faxID = "";
   FileInfo f = new FileInfo(faxFile);
   if(f.Exists)
   {
    //FAXCOMLib.FaxServer faxsvr = null;
    FAXCOMLib.FaxDoc faxdoc = null;
    try
    {
     faxsvr = new FAXCOMLib.FaxServer();
     faxdoc = (FAXCOMLib.FaxDoc)faxsvr.CreateDocument(f.FullName);
    }
    catch(Exception ex)
    {
     errorMessage = ex.Message;
     writeFile("create fax server error! " + errorMessage);//Environment.MachineName
    }
    try
    {
     faxsvr.Connect(hostName); // or specify the computer name  Environment.MachineName
    }
    catch (Exception ex )
    {
     errorMessage = ex.Message;
     writeFile("link host "+hostName+ " error! " + errorMessage);
    }

    try
    {
     faxdoc.FileName =f.FullName;
     faxdoc.RecipientTitle = "RecipientTitle";
      faxID = f.Name;//System.DateTime.Now.ToString();/
     //faxdoc.RecipientZip = faxID;
     //writeFile("sendFax faxFile= "+faxFile + "; f.fullname=" + faxdoc.FileName);
//     //-----------------------------------------------------////////
     faxdoc.RecipientAddress = "RecipientAddress";
     faxdoc.RecipientCompany = "RecipientCompany";
     faxdoc.RecipientCountry = "RecipientCountry";
     faxdoc.RecipientDepartment = "RecipientDepartment";
     faxdoc.RecipientHomePhone = "RecipientHomePhone";
     faxdoc.RecipientName = faxID;/**/////////////传真id号
     faxdoc.RecipientOffice = "RecipientOffice";
     faxdoc.RecipientOfficePhone = "RecipientOfficePhone";
     //faxdoc.SendCoverpage = 0;
     faxdoc.SenderAddress = "SenderAddress";
     faxdoc.SenderCompany = "SenderCompany";
     faxdoc.SenderDepartment = "SenderDepartment";
     faxdoc.SenderFax = "SenderFax";
     faxdoc.SenderHomePhone = "SenderHomePhone";
     faxdoc.SenderOfficePhone = "SenderOfficePhone";
     faxdoc.SenderTitle = "SenderTitle";
     //faxdoc.ServerCoverpage = 1;
     faxdoc.CoverpageName = "CoverpageName";
     faxdoc.CoverpageNote = "CoverpageNote";
     faxdoc.CoverpageSubject = "CoverpageSubject";
//     //------------------------------------------------------//////////
     faxdoc.FaxNumber =faxNumber;// Specify the Fax Number;
     //writeFile("f.FullName= "+f.FullName + "; faxdoc.FileName=" + faxdoc.FileName);
     intsend = faxdoc.Send();