经典ASP,发送电子邮件错误'8004020f'

时间:2013-10-10 06:55:56

标签: asp-classic

我发送邮件时收到错误

  

错误'8004020f'
  /sis/mail.asp,第168行

这是我的代码。

Set cdoConfig = Server.CreateObject( "CDO.Configuration")

cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail.dartconsulting.info"
cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 
cdoConfig.Fields.Update

Set cdoMessage = Server.CreateObject ("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "darteam28@gmail.com"

cdoMessage.To=email
cdoMessage.Subject = "Your  Password"
cdoMessage.HtmlBody = "<table><tr><td></td></tr>"&_
                "<tr><td colspan=2>Please find below your password</td></tr>"&_
                "<tr><td>Password :&nbsp;&nbsp;"&password&"</td></tr>"&_
                "<tr><td>UserName :&nbsp;&nbsp;"&uid&"</td></tr>"&_
                "<tr><td>EmailID :&nbsp;&nbsp;"&email&"</td></tr>"&_
                "<tr><td colspan=2>Please login and confirm/change your emailid</td></tr><table>"

cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing

4 个答案:

答案 0 :(得分:4)

Vogel612表示,您的帖子中没有足够的信息来解决问题。但是,到目前为止,最可能的原因是服务器mail.dartconsulting.info需要身份验证,而您尝试在未经身份验证的情况下发送。

我已从本地计算机连接到此服务器并且它给了我550 Authentication is required for relay,因此即使您位于同一台服务器上,您也很可能需要进行身份验证。

请参阅本网站: http://www.powerasp.net/content/new/sending_email_cdosys.asp (或进行Google搜索)了解如何通过身份验证向CDO发送电子邮件。

答案 1 :(得分:0)

这项工作对我来说:http://www.powerasp.net/content/new/sending_email_cdosys.asp

Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message") 

'This section provides the configuration information for the remote SMTP server.

ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="remoteserver"
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60


ObjSendMail.Configuration.Fields.Update

'End remote SMTP server configuration section==

ObjSendMail.To = "test@test.com"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "someone@someone.net"

' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"

ObjSendMail.Send

Set ObjSendMail = Nothing 

答案 2 :(得分:0)

使用1而不是2

进行发送

ObjSendMail.Configuration.Fields.Item(&#34; http://schemas.microsoft.com/cdo/configuration/sendusing&#34;)= 1

答案 3 :(得分:0)

系统将在无效的收件人电子邮件地址上产生错误'8004020f'

就我而言,该问题与@符号前带有空格的无效电子邮件地址有关。