维维
首页
新随笔
联系
订阅
管理
8 Posts :: 66 Stories :: 19 Comments :: 0 Trackbacks
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
(1)
给我留言
查看留言
文章分类
(65)
XmlHttp (1)
.net安全(7)
.net学习(26)
Ajax
API (1)
asp.net控件(8)
DataGrid(4)
DropDownList
HTC
HTML(2)
javascript(7)
SQLSERVER(6)
UML
Web Services
常用正则表达式(1)
设计与模式(2)
收藏夹
(3)
菜鸟(3)
积分与排名
积分 - 8981
排名 - 3701
最新评论
阅读排行榜
1. 在ASP.NET 中实现单点登录(从老孟那里抄的)(601)
2. 如何开发国际化软件(381)
3. 经典笑话(儿童不宜)(116)
4. 精彩的BLOG(105)
5. 面向模式的分析和设计(83)
评论排行榜
1. 在ASP.NET 中实现单点登录(从老孟那里抄的)(5)
2. 面向模式的分析和设计(0)
3. 如何开发国际化软件(0)
4. 安全地保存配置项 (0)
发送传真的c#方法- -
发送传真的c#方法
-
-
/**/
///
<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);
}
}
posted on 2006-01-09 16:40
维维
阅读(115)
评论(2)
编辑
收藏
所属分类:
.net学习
Feedback
#1楼
2007-04-23 15:35
xing [未注册用户]
有問題要請教你,請和我聯系,謝謝!
faxsvr.Connect(hostName); 總是出錯。
回复
引用
#2楼
2007-04-23 15:35
xing [未注册用户]
有問題要請教你,請和我聯系,謝謝!
faxsvr.Connect(hostName); 總是出錯。
qq:654179816
qq:466909582
謝謝,在線等待。
回复
引用
新用户注册
刷新评论列表
标题
姓名
主页
Email
(博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
网站首页
新闻频道
社区
小组
博问
网摘
闪存
找找看
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
相关链接:
所属分类的其他文章:
将上传图片打上防伪图片水印并写入数据库
ASP.NET程序中常用的代码
查看服务器磁盘、文件的aspx
对IIS中的虚拟目录进行操作
.net打包自动安装数据库
C#版的网站新闻发布系统
XML、DataSet、DataGrid结合写成广告管理程序
C#函数实现的小功能集合
文件的一些基本操作
ASP.NET结合存储过程写的通用搜索分页程序
最新IT新闻:
Silverlight 2.0正式版下周发布
Wikipedia“变心”,力挺Ubuntu
“不可破解”的加密技术出
13款Firefox Gmail扩展
支持鼠标手势的Chrome中文修改版
Powered by:
博客园
Copyright © 维维