全部产品

Windows虚拟主机CDOSYS发信组件使用样例

更新时间:2017-06-07 13:26:11

Windows系统虚拟主机通过CDOSYS组件发送邮件的代码样例

1.  ASP程序示例: 

<%
'以下部分为系统配置,请勿更改
Set objMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 1
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout&quot;) = 60
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory&quot;) = "c:\Inetpub\mailroot\Pickup"
objCDOSYSCon.Fields.Update
Set objMail.Configuration = objCDOSYSCon
'系统配置结束
'以下为用户自行更改部分,请由程序员进行修改
objMail.From = "test@www.net.cn"
objMail.Subject = "win2003发信组件测试"
'把下面的email改成自己的
objMail.To = "norelay@hichina.com"
objMail.TextBody = "win2003测试发信组件正常"
objMail.Send
Set objMail = Nothing
Set objCDOSYSCon = Nothing
%>
<%="发送成功!!!"%>

 



2.  ASP.NET程序示例:

<%
'以下部分为系统配置,请勿更改
dim objMail as object
dim objCDOSYScon as object
objMail = Server.CreateObject("CDO.Message")
objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 1
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout&quot;) = 60
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory&quot;) = "c:Inetpub\mailroot\Pickup"
objCDOSYSCon.Fields.Update
objMail.Configuration = objCDOSYSCon
'系统配置结束
'以下为用户自行更改部分,请由程序员进行修改
objMail.From = "test@www.yourdomain.com"
objMail.Subject = "win2003发信组件测试"
'把下面的email改成自己的
objMail.To ="test@yourdomain.com"
objMail.TextBody = "win2003测试发信组件正常"
objMail.Send
objMail = Nothing
objCDOSYSCon = Nothing
%>版权声明:本示例程序仅仅授权中国万网 ASP.NET
虚拟主机用户使用。其他任何方式的使用需经中国万网书面授权。
<%=>


如果问题还未能解决,您可以到阿里云社区进行免费咨询,或联系云市场商家寻求帮助。