Sorry I got a bit busy. I have tested this on a 2003 server, the code is strait from the MS website. If this doesnt work for you its not the code, its your SMTP set up (or the lack of), firewall, etc..
<!--
Sending SMTP mail via port 25 using CDOSYS This ASP page
uses CDOSYS to send SMTP mail using port 25 of the SMTP
server that is set. The e-mail delivery is handled by the
SMTP server that is set in the configuration object.
-->
<%
Const cdoSendUsingPort = 2
Dim iMsg,iConf,Flds,strHTML,strSmartHost
StrSmartHost = "your mail IP - is a string"
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
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With
'apply the settings to the message
With iMsg
Set .Configuration = iConf
.To = "
[email protected]"
.From = "
[email protected]"
.Subject = "CDOSYS Test"
.HTMLBody = "sent using CDOSYS"
.Send
End With
' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>
BTW: I had no trouble getting this to work. In fact I have just tryed it on a server that was not happy sending external (outside our network) mail using CDONTS. This method works like a charm.
Wind is your friend
Matt