Microsoft KB Archive/248687

= How to send mail from an Active Server Page by using CDOEX with Exchange 2000 Server or Exchange Server 2003 =

Article ID: 248687

Article Last Modified on 4/4/2006

-

APPLIES TO


 * Microsoft Exchange 2000 Server Standard Edition
 * Microsoft Exchange Server 2003 Enterprise Edition
 * Collaboration Data Objects for Exchange 2000, when used with:
 * Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)

-



This article was previously published under Q248687



SUMMARY
This article demonstrates how to send an e-mail message from an Active Server Pages page by using the Collaboration Data Objects for Exchange 2000 (CDOEX.dll). The sample code provided below takes input from the user and sends an e-mail message by using CDOEX.



MORE INFORMATION
This article assumes that you have:
 * Microsoft Windows 2000 or Microsoft Windows Server 2003
 * Microsoft Exchange 2000 Server or Microsoft Exchange Server 2003
 * Microsoft Internet Information Server (IIS) 5.0 or higher

To use the sample code, follow these steps:  Create a folder under \Inetpub\wwwroot named Sendmailsample. Open Notepad.  Paste the following code. <%@ Language=VBScript %> <% submit = Request.Form.Item("B1")

if submit = "Send"

then

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

Dim iConf Set iConf = CreateObject("CDO.Configuration")

Dim Flds Set Flds = iConf.Fields

' 3 means that you are asking mail to be sent using Exchange Server.

'TODO: Change the "user" and "password" values to match your environment

Flds( "http://schemas.microsoft.com/cdo/configuration/sendusing") = 3

Flds("http://schemas.microsoft.com/cdo/configuration/user") = "Username"

Flds("http://schemas.microsoft.com/cdo/configuration/password") = "Password"

Set iMsg.Configuration = iConf

iMsg.To = Request.Form.Item("Text1")

iMsg.From = "administrator@domain.com"

iMsg.Subject = Request.Form.Item("Text3")

iMsg.TextBody = Request.Form.Item("TextArea1")

iMsg.Send

end if %>  <% if submit = "Send" then %>  Mail Sent  <% else%>     <%end if %>  Save the file as Sendmail.asp in the Sendmailsample folder that you created above.</li> Open Internet Service Manager.</li> In the properties for the Sendmailsample folder, set the security properties to Digest Authentication for Windows Domain Servers and Integrated Windows Authentication.</li> Load the page in IIS.</li> Fill in the form, and then click Send.</li></ol>

Keywords: kbhowto kbmsg KB248687

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.