指引网

当前位置: 主页 > 编程开发 > ASP >

asp 发送邮件代码,支持外国主机

来源:网络 作者:佚名 点击: 时间:2017-06-22 20:45
[摘要] % sendUrl=http://schemas.microsoft.com/cdo/configuration/sendusing smtpUrl=http://schemas.microsoft.com/cdo/configuration/smtpserver ' Set the mail server configuration Set objConfig=CreateObject(CDO.Configuration) objConfig.Fields.Item(sen

<%
sendUrl="http://schemas.microsoft.com/cdo/configuration/sendusing"
smtpUrl="http://schemas.microsoft.com/cdo/configuration/smtpserver"


' Set the mail server configuration
Set objConfig=CreateObject("CDO.Configuration")
objConfig.Fields.Item(sendUrl)=2 ' cdoSendUsingPort
objConfig.Fields.Item(smtpUrl)="relay-hosting.secureserver.net"
objConfig.Fields.Update


' Create and send the mail
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From="sender@coolexample.com"
objMail.ReplyTo="sender@coolexample.com"
objMail.To="recipient@coolexample.com"
objMail.Subject="subject"
objMail.TextBody="body"
objMail.Send
%>

------分隔线----------------------------