【问题标题】:Cannot send the emails through the ASP Form无法通过 ASP 表单发送电子邮件
【发布时间】:2014-11-03 08:06:55
【问题描述】:

由于以下错误,我无法通过表单发送电子邮件。我认为由于 CDO 被贬低,该表格不起作用?我不确定,但我也不确定如何解决这个问题。

CDO.Message.1 错误“80040220”

“SendUsing”配置值无效。

/thankyou.asp,第 24 行

代码

<%
Set objMail = Server.CreateObject("CDO.Message")

objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Update

objMail.From = Request.Form("Email") ' change this to an email address
objMail.To = "admin@domain.com" ' change this to your email address
objMail.Subject = "name Questions/Comments" ' change this to your subject
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) 

'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) 
objMail.HTMLBody = "<font size=3 face=verdana>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "From: " & "</strong>" & Request.form("Name") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Email: " & "</strong>" & Request.Form("Email") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Phone: " & "</strong>" & Request.Form("Phone") & "<br>" & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Questions/Comments: " & "</strong>" & "<br>" & Replace(Request.Form("Details"), vbCrLf, "<br />") & "<br>" & "<br>" & "</font>"
'objMail.HTMLBody = objMail.HTMLBody & "<em>" & "Sent at " & Now() & "</em>" & "</font>"

objMail.Send()

Set objMail = Nothing*

%>

我无权访问物理服务器,也无法自行更改权限。

http://blogs.msdn.com/b/akashb/archive/2010/05/24/error-cdo-message-1-0x80040220-the-quot-sendusing-quot-configuration-value-is-invalid-on-iis-7-5.aspx

任何想法如何修复这段代码以使其再次工作?

我试过这个:http://forums.iis.net/t/1146477.aspx?The+SendUsing+configuration+value+is+invalid+

将 SendUsing 更改为 1。

并设置 google snmp 以发送电子邮件而没有太多结果。任何信息都会有所帮助。

【问题讨论】:

标签: forms email asp-classic


【解决方案1】:

用这个替换你的代码:

<%
Set cdoConfiguration = Server.CreateObject("CDO.Configuration") 

With cdoConfiguration 
  .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 
  .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
  .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
  .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 
  .Fields.Update 
End With 

Dim tmpStr
tmpStr = ""

tmpStr = "<font size=""3"" face=""verdana"">"
tmpStr = tmpStr & "<ul>"
tmpStr = tmpStr & "<li><strong>" & "From: " & "</strong>: " & Request.form("Name") & "</li>"
tmpStr = tmpStr & "<li><strong>" & "Email: " & "</strong>: " & Request.form("Email") & "</li>"
tmpStr = tmpStr & "<li><strong>" & "Phone: " & "</strong>: " & Request.form("Phone") & "</li>"
tmpStr = tmpStr & "<li><strong>Questions/Comments</strong>:<br/>"
tmpStr = tmpStr & Replace(Request.Form("Details"), vbCrLf, "<br />")
tmpStr = tmpStr & "</li>"
tmpStr = tmpStr & "</ul>"
tmpStr = tmpStr & "<p>Sent at " & Now() & "</p>"
tmpStr = tmpStr & "</font>"

Set newMailObj           = Server.CreateObject("CDO.Message") 
newMailObj.Configuration = cdoConfiguration 
newMailObj.Subject       = "name Questions/Comments" 
newMailObj.From          = Request.Form("Email")
newMailObj.To            = "admin@domain.com" 
newMailObj.HTMLBody      = tmpStr 

newMailObj.Send 

set newMailObj = nothing     
set cdoConfiguration = nothing
%>

如果它是这样工作的,请告诉我们,因为如果是这样,您的代码(或至少您粘贴给我们的部分)不正确...

顺便说一句,如果您使用的是localhost,我几乎可以肯定不需要服务器配置...如果您使用像smtp.server.com 这样的远程服务器,则必须这样做

【讨论】:

  • 我刚刚打电话给客户支持,看看我们是否可以使用 localhost,他们给了我通往 Out smtp 的网关,但仍然可以正常工作。
  • 那么,它现在是否有效,如果没有,我粘贴的这段代码仍然无效?然后你应该向你的主机请求一个例子,因为他们的常见问题解答中总是有这些......可能是一个特殊的配置。
  • 我明天会的。有人告诉我,他们所做的配置可能需要一些时间才能生效。我明天早上会研究这个。谢谢。
  • 成功了,谢谢。我不得不花一个半小时与客户服务部门也发现我们有 2 个 FTP 帐户。我的那个不是正确的,即使内容是一样的......非常感谢!
猜你喜欢
  • 2013-02-21
  • 2016-03-10
  • 1970-01-01
  • 2012-01-26
  • 2014-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多