【问题标题】:How to send email from ASP application on Windows 2008 Server如何从 Windows 2008 Server 上的 ASP 应用程序发送电子邮件
【发布时间】:2009-08-05 17:31:52
【问题描述】:

我的 ASP,经典 ASP 应用程序在 Windows 2008 服务器上给我一个服务器错误。它在 Windows 2003 服务器上运行良好。该错误是 500 内部服务器错误。 CDO 不能在 Windows 2008 上运行吗?

编辑 错误是:传输无法连接到服务器。

这是我的邮件功能:

function SendMail(mailFrom, mailTo, mailSubject, mailBody, bHtml)
Const cdoSendUsingMethod        = _
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort          = 2
Const cdoSMTPServer             = _
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort         = _
"http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout  = _
"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate       = _
"http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic                  = 1
Const cdoSendUserName           = _
"http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword           = _
"http://schemas.microsoft.com/cdo/configuration/sendpassword"
Const smtpServer = "localhost"

Dim objConfig  ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields     ' As ADODB.Fields

' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields

' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod)       = cdoSendUsingPort
.Item(cdoSMTPServer)            = smtpServer
.Item(cdoSMTPServerPort)        = 25
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate)      = cdoBasic
.Item(cdoSendUserName)          = "username"
.Item(cdoSendPassword)          = "password"

.Update
End With

Set objMessage = Server.CreateObject("CDO.Message")

Set objMessage.Configuration = objConfig

With objMessage
.To       = mailTo
.From     = mailFrom
.Subject  = mailSubject
if bHtml then
.HtmlBody = mailBody
else    
.TextBody = mailBody
end if
.Send
End With

Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing

end function

【问题讨论】:

  • 从 ASP 应用程序 Windows 2008 服务器发送电子邮件有哪些选项?

标签: asp-classic smtp windows-server-2008


【解决方案1】:

在 Windows 2008 中似乎没有默认安装 CDO/MAPI 库:

你可以download them from Microsoft

引用from this blogpost

如果你想写客户端 在计算机上运行的应用程序 使用 MAPI 或 CDO(例如,Web 服务器)并且您不想安装 (或无法安装)Outlook 客户端或 Exchange 管理 工具,那么你需要安装 MAPI/CDO 库。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-17
  • 1970-01-01
  • 2013-02-04
  • 1970-01-01
  • 1970-01-01
  • 2013-03-13
相关资源
最近更新 更多