Här kommer ett exempel (något gammal som jag knåpat ihop nån gång):
' send by connecting to port 25 of the SMTP server
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Dim obj
Const cdoSendUsingPort = 2
StrSmartHost = "min.mailserver.nu"
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
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = Basic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "dittanvändarnamn"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "dittlösenord"
.Update
End With
' build for message body
sBody = Request.Form("meddelande")
'For Each field In Request.Form
' sBody = sBody & field & ": " & Request.Form(field) & Chr(13) & Chr(10)
'Next
' apply the settings to the message
With iMsg
Set .Configuration = iConf
.To = "till@nagon.se"
.From = Request.Form("epost")
.Subject = "Meddelande från Dig"
.TextBody = sBody
.Send
End With
' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
