Try this. It works for me.

Sub sendmailCDO(eaddress As String, ecc As String, ebcc As String, efrom As String, esubj As String, ebody As String,
eattachment As String)
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iConf As New CDO.Configuration
Dim Flds As ADODB.Fields
Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort ' 2
Flds(cdoSMTPServer) = "smtp.server.com"
Flds(cdoSMTPServerPort) = 25
'Flds(cdoSMTPAccountName) = "My Name"
'Flds(cdoSMTPAuthenticate) = cdoBasic ' 1
' IMPORTANT: Storing user names and passwords inside source code
' can lead to security vulnerabilities in your software. Do not
' store user names and passwords in your production code.
'Flds(cdoSendUserName) = "domain\username"
'Flds(cdoSendPassword) = "password"
'Flds(cdoSendEmailAddress) = """MySelf"" <example@example.com>"
'Flds(cdoSMTPUseSSL) = True
Flds.Update
Dim iMsg As New CDO.Message
Set iMsg.Configuration = iConf
' ... compose message; add attachments, etc
With iMsg
Set .Configuration = iConf
.To = eaddress
.CC = ecc
.BCC = ebcc
.from = efrom '"""MySelf"" <example@example.com>"
.Subject = esubj '"Test"
.TextBody = ebody ' "Body text"
.AddAttachment eattachment ' "D:\temp\text.txt"
' You can add any file you want with this line .AddAttachment "C:/Test.txt"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub