GoDaddy的windows主机如何使用CDONTS.NewMail发送邮件
由于GoDaddy的windows主机不支持jmail组件,但可以使用CDONTS.NewMail组件替代来发送邮件, 具体写法如下:
<%
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=”webmaster@godaddy.com” 这里一定要是GoDaddy提供的邮局,否则发送不了
objMail.To=”xxx@example.com”
objMail.Subject=”subjec”
objMail.TextBody=”body”
objMail.Send
Response.Write “邮件发送成功!”
if Err <> 0 then
response.write “<font color=ff0000>”&Err.Description&”</font>”
response.end
end if
%>