高分求解CDO发送邮件乱码问题,在线等待中!!!!

westbulls 2004-09-20 05:47:10
用下面函数发送邮件接收后是乱码,help,help!!!!
<%
function mail(smtpserver,user,password,email,from,Subject,Body,htmlbody)
Const cdoSendUsingMethod="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort=2
Const cdoSMTPServer="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic=1
Const cdoSendUserName="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Const cdoSendlanguagecode="http://schemas.microsoft.com/cdo/configuration/languagecode"

Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

With Fields
.Item(cdoSendUsingMethod)= cdoSendUsingPort
.Item(cdoSMTPServer)=smtpserver
.Item(cdoSMTPServerPort)=25
.Item(cdoSMTPConnectionTimeout)=10
.Item(cdoSendlanguagecode)="gb2312"
.Item(cdoSMTPAuthenticate)=cdoBasic
.Item(cdoSendUserName)=user
.Item(cdoSendPassword)=password
.Update
End With

Set objMessage = Server.CreateObject("CDO.Message")
with objMessage
Set .Configuration = objConfig
.To=email
.From=from
.Subject=Subject
if trim(htmlbody)<>"" then
.HTMLBody=htmlbody
else
.TextBody=body
end if
.Send
end with
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
if err.number=0 then
mail="您给 <font color='#FF0000'>"&email&"</font> 的通知邮件已发出"
else
mail="您给 <font color='#FF0000'>"&email&"</font> 的通知邮件发送失败"
end if
end function
%>
...全文
142 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Amely 2004-09-21
  • 打赏
  • 举报
回复
up
ljqhbt 2004-09-21
  • 打赏
  • 举报
回复
在调试的时候有没有将自己的邮件接收软件设置好.看看好象没问题.
BlueDestiny 2004-09-20
  • 打赏
  • 举报
回复
试试将中文转为unicode编码,再加上<%@codepage=936%>

-----------------------------

建议:用jmail

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧