2009-08-05 16 views
2

My ASP、従来のASPアプリケーションは、Windows 2008 Serverで重大なエラーを表示しています。それはWindows 2003サーバー上で正常に動作します。エラーは内部サーバーエラー500です。 CDOはWindows 2008で動作しませんか?Windows 2008 Server上のASPアプリケーションから電子メールを送信する方法

EDIT エラーは次のとおりです。トランスポートがサーバーに接続できませんでした。

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 
+0

オプションは何ですか?ASPアプリケーションのWindows 2008サーバーから電子メールを送信しますか? – Picflight

答えて

5

CDO/MAPIライブラリは、Windows 2008にデフォルトでインストールされていないことが表示されます:あなたはdownload them from Microsoftでき

は、ここに私のメール機能です。 from this blogpostを参照さ

あなたがクライアントにその 利用MAPIまたはCDO(例えば、ウェブ サーバー)をコンピュータ上で実行するように アプリケーションを作成したい場合、あなたは をインストールしたくない(またはOutlook クライアントまたはExchange管理 ツールのいずれかをインストールできない場合は、 MAPI/CDOライブラリをインストールする必要があります。

+0

リンクが壊れているので、新しいものがここにあります:http://www.microsoft.com/en-us/download/details.aspx?id=1004 – stare

+0

アドバイスをいただきありがとうございます! – stare

関連する問題