/**//// <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();
writeFile("faxdoc.tsid= " + faxdoc.SendCoverpage + "; GetHashCode" + faxdoc.GetHashCode() + "; FileName:" + faxdoc.FileName );
//System.Threading.Thread.Sleep(2000);
//faxsvr.Disconnect();
writeFile("send successfully["+intsend+"] " + f.FullName + " " +"(faxNumber: " +faxNumber +";hostName: " +hostName+ ")");
sign = 1;
}
catch ( Exception ex )
{
errorMessage = ex.Message;
writeFile("send error["+intsend+"] " +f.FullName+" "+errorMessage + "(faxNumber: " +faxNumber +";hostName: " +hostName+")");
sign =0;
//System.Threading.Thread.Sleep(5000);
}
}
else
{
sign =0;
errorMessage = "error:"+faxFile +" not exist !";
writeFile(errorMessage);
}
if( sign ==0)
{
sql = "UPDATE job_log SET result_message = 'error:"+errorMessage.Replace("'","''")+"',log_title='"+faxID+"' " ;
sql += " Where sql like '%"+f.Name +"' and event_type ='FAX'";
sqlUpdate(sql);
}
else if (sign ==1)
{
sql = "UPDATE job_log SET result_message = 'successfully',log_title ='"+faxID+"'" ;
sql += " Where sql like '%"+f.Name +"' and event_type ='FAX'";
sqlUpdate(sql);
}
}
好像有个这样的组件。InterFax
这里有篇关于InterFax的文章,你可以参考下:
http://pengxinming123.blog.163.com/blog/static/10952634320102322642851/
还有个关于FLEX+ASP.NET的例子:
http://download.csdn.net/source/2129487
不过前段时候在做项目时候有这块的需求,对外贸易方面的传真,不过后来放弃了,由于国家这块好像现在管的比较严,阿里巴巴的外贸版原来就提供这个功能现在好像也取消了