简体   繁体   English

如何从Windows 2008 Server上的ASP应用程序发送电子邮件

[英]How to send email from ASP application on Windows 2008 Server

My ASP, classic ASP application is giving me a sever error on a Windows 2008 Server. 我的ASP,经典的ASP应用程序在Windows 2008 Server上给我一个严重错误。 It works fine on Windows 2003 server. 它在Windows 2003 Server上运行良好。 The error is a 500 internal server error. 该错误是500个内部服务器错误。 Does CDO not work on Windows 2008? CDO在Windows 2008上不起作用吗?

EDIT THe error is: The transport failed to connect to the server. 编辑错误是:传输无法连接到服务器。

Here is my mail function: 这是我的邮件功能:

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

It appears that the CDO/MAPI libraries aren't installed by default in Windows 2008: 在Windows 2008中,默认情况下似乎未安装CDO / MAPI库:

You can download them from Microsoft . 您可以从Microsoft下载它们

Referenced from this blogpost : 从此博客文章引用:

If you want to write client applications to run on computers that use MAPI or CDO (for example, web servers) and you don't want to install (or can't install) either the Outlook client or the Exchange management tools, then you need to install the MAPI/CDO libraries. 如果要编写客户端应用程序以使其在使用MAPI或CDO的计算机(例如Web服务器)上运行,并且不想安装(或不能安装)Outlook客户端或Exchange管理工具,则可以需要安装MAPI / CDO库。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows 2008 Server如何获取ASPEmail发送到自己的域 - windows 2008 server how to get ASPEmail to send to own domain 迁移问题:ASP经典应用程序中的错误“ 80040e14”从Windows Server 2003 / SQL Server 2000迁移到Windows Server 2008 R2 / SQL Server 2012 - Migration Issue: error '80040e14' in ASP classic application from Windows server 2003/SQL Server 2000 to Windows Server 2008 R2/SQL Server 2012 如何使用 CDO.Message 在经典 ASP 中从 Windows Docker Z5DA5ACF461B4EFB7E7ZEC801916 发送 email - How to use CDO.Message to send email in Classic ASP from Windows Docker IIS 2019 从Windows Server 2008发出请求时经典ASP中的错误 - Error in classic asp while making request from windows server 2008 Windows 2008 Server和经典ASP目录查询 - windows 2008 server and classic ASP catalog queries 如何在Classic ASP中使用Exchange服务器发送电子邮件? - How to send email by using Exchange server in Classic ASP? 从Windows Server 2003迁移到Server 2008后,ASP Classic功能似乎无法正常工作 - ASP Classic function appears to not work after migration from Windows Server 2003 to Server 2008 ASP电子邮件-objCDOMail.Send服务器错误 - ASP Email - objCDOMail.Send server error IIS 7 + Windows Server 2008-使用CDO从Classic ASP发送电子邮件 - IIS 7 + Windows Server 2008 - Sending Emails from Classic ASP using CDO 经典ASP仅返回Windows Server 2008上记录集中的单个记录 - Classic ASP returns only single record from recordset on Windows Server 2008
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM