email capabilites with cdo for exchange in vb6
hey guys
i'm afraid i'm at a complete loss.
basically i want to add an email capability to one of my apps
i've managed to get some code that works but it uses
code such as:
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
now from what i understand i substitute the code above with:
!cdoSMTPUseSSL = True
once i have referenced the "cdo for windows" library cdosys.dll.
problem is that i dont have cdosys.dll but have cdoex.dll (cdo for exchange 2000 library) which i understand replaced cdosys.dll (i.e. has the same functionallity and more)
the code dosnt work however and i get an error message
cdo error, the sendusing configuration value is invalid
so i guess what i'm really after is vb6 example code, which sends emails and references "cdo for exchange 2000" library. can anyone point me in the right direction? 4hrs of searching has thrown up very little :(
alternativly where can i get cdo for windows library?
also the code i have which has the schemas.micosoft.com in it, does work but am worried that the code is not "self contained" i.e. it has to look up microsoft.com each time to send a mail??
thanks for the help yet again!!
jim
Re: email capabilites with cdo for exchange in vb6
Here is a working CDO Code i use in my project :D
This example uses gmail smtp service to send emails
Code:
Public Function cdo_email_gmail(smtp As String, port As Long, gwpass As String) As Boolean 'Mail
On Error GoTo err
'Add the Project Reference Miscrosoft CDO WINDOWS FOR 2000
Dim lobj_cdomsg As CDO.message
Set lobj_cdomsg = New CDO.message
With lobj_cdomsg.Configuration
.Fields(cdoSMTPServer) = smtp
.Fields(cdoSMTPConnectionTimeout) = 60
.Fields(cdoSendUsingMethod) = cdoSendUsingPort
.Fields(cdoSMTPServerPort) = port '465 works for gmail
.Fields(cdoSMTPAuthenticate) = True
.Fields(cdoSMTPUseSSL) = True
.Fields(cdoSendUserName) = Form2.txtfrom.Text
.Fields(cdoSendPassword) = gwpass
.Fields.Update
Dim toMail As String
Dim optSubject As String
Dim body As String
body = "test message"
lobj_cdomsg.To = Form2.txtTo
lobj_cdomsg.From = Form2.txtfrom
lobj_cdomsg.ReplyTo = Form2.txtfrom
lobj_cdomsg.Subject = Form2.txtSubject
lobj_cdomsg.TextBody = vbCrLf & body
lobj_cdomsg.AddAttachment App.path & "\" & "abc.jpg"
lobj_cdomsg.Send
Set lobj_cdomsg = Nothing
cdo_email_gmail = True
Exit Function
This code i just using in my projects. so text boxes mensioned here are in my project. modify it to suit your needs.
i am distributing cdosys.dll in my installation. works well in xp and vista.
:wave:
Re: email capabilites with cdo for exchange in vb6
thanks fazi
you code is pretty much what i was hoping to use,
except i dont havethe cdo for windows 2000 library
but i have cdo for exchange 2000 library.
the code fails when using exchange 2000 library
thanks all that same
if i find a soln i'll post back but its not looking good!
jim
Re: email capabilites with cdo for exchange in vb6
google cdosys.dll download for many choices