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"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = your smtp server
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 20
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = your send email adress
.Item(cdoSendPassword) = your password
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = email receipent
.From = email sender
.Subject = subject of mail
.HTMLBody = your email
End With
objMessage.AddAttachment /path of your file
objMessage.send
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
If its CDO, here is a MS Blog article describing the code required.
Link: http://blogs.technet.com/b/heyscriptingguy/archive/2004/11/29/how-can-i-attach-a-file-to-an-email-sent-using-cdo.aspx
Dan