相关资讯
本类常用软件
-
福建农村信用社手机银行客户端下载下载量:584204
-
Windows优化大师下载量:416896
-
90美女秀(视频聊天软件)下载量:366961
-
广西农村信用社手机银行客户端下载下载量:365699
-
快播手机版下载量:325855
下面提供给大家分享的是关于在ASP中使用CDO.Message+SMTP发送邮件的函数代码,希望能对大家有所帮助。
<!--发送代码-->
<%
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"
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) = "SMTP服务器" '改成可用的外部邮件服务器域名
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "用户名" '以上服务器的用户名
.Item(cdoSendPassword) = "密码" '密码
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = Trim(Request.Form("m_user")) '改成接收者的邮件地址
.From = "发件人的地址(要和上面的邮件系统相同)" '改成发送人的邮件地址
.Subject = Trim(Request.Form("m_zhuzi")) '标题
.TextBody = Trim(Request.Form("m_neirong")) '正文
'.AddAttachment "C:\Scripts\Output.txt"'邮件附件
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>
<!--发送代码-->
<%
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"
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) = "SMTP服务器" '改成可用的外部邮件服务器域名
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "用户名" '以上服务器的用户名
.Item(cdoSendPassword) = "密码" '密码
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = Trim(Request.Form("m_user")) '改成接收者的邮件地址
.From = "发件人的地址(要和上面的邮件系统相同)" '改成发送人的邮件地址
.Subject = Trim(Request.Form("m_zhuzi")) '标题
.TextBody = Trim(Request.Form("m_neirong")) '正文
'.AddAttachment "C:\Scripts\Output.txt"'邮件附件
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
%>
<!--发送代码-->
热门评论
最新评论