|
SMTP (CDO) support in windows 2003 server
CDONTS is not a feature in Windows Server 2003. In windows server 2003 you can convert using CDO instead
of CDONTS to generate mails from a asp-page.
Use the newer cdosys library using the following code
<%
' Send by connecting to port 25 of the SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Const cdoSendUsingPort = 2
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' Set the CDOSYS configuration fields to
use port 25 on the SMTP server.
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")
= cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "202.146.192.134"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
.Update
End With
' Build HTML for message body.
'strHTML = "<b> This is the test HTML message
body</b></br>"
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "test@test.com" 'ToDo: Enter a valid email address.
.From = "test@test.com" 'ToDo: Enter a valid email address.
.Subject = "This is a test CDOSYS message (Sent via Port 25)"
.HTMLBody = "<b> This is the test HTML message body</b></br>"
.AddAttachment(Server.Mappath("EMP.TXT"))
.Send
End With
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
response.Write("Mail Successfully send")
%>
|