By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

Issue on send mail by using CDOSYS.DLL

P: n/a
Hi all,

I develop an VB6 program to send email by using CDOSYS.DLL. It works fine as
follow:

Dim iMsg As New CDO.Message
Dim iDsrc As CDO.IDataSource
Set iDsrc = iMsg ' (QueryInterface)
Dim iConf As New CDO.Configuration
Dim Flds As ADODB.Fields
Set Flds = iConf.Fields

With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.myServer.com"
.Item(cdoSMTPServerPort) = "123"
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSMTPUseSSL) = True
.Item(cdoSendUserName) = "user"
.Item(cdoSendPassword) = "password"

.Update
End With

With iMsg
Set .Configuration = iConf
.To = "ot***@myServer.com"
.From = "me@myServer.com"
.Subject = "Testing 123"
.Send
End With
However, when i migrate to VB.NET as follow:
Dim iMsg As New CDO.Message
Dim iConf As New CDO.Configuration
Dim iFlds As ADODB.Fields
Dim oField As ADODB.Field

iFlds = iConf.Fields

Try
oField = iFlds(CDO.CdoConfiguration.cdoSendUsingMethod)
oField.Value = CDO.CdoSendUsing.cdoSendUsingPort
oField = iFlds(CDO.CdoConfiguration.cdoSMTPServer)
oField.Value = "smtp.myServer.com"
oField = iFlds(CDO.CdoSendUsing.cdoSendUsingPort)
oField.Value = 123
oField = iFlds(CDO.CdoConfiguration.cdoSMTPAuthenticate)
oField.Value = CDO.CdoProtocolsAuthentication.cdoBasic
oField = iFlds(CDO.CdoConfiguration.cdoSMTPUseSSL)
oField.Value = True
oField = iFlds(CDO.CdoConfiguration.cdoSendUserName)
oField.Value = "user"
oField = iFlds(CDO.CdoConfiguration.cdoSendPassword)
oField.Value = "password"

iFlds.Update()

iMsg.Configuration = iConf
iMsg.From = "ot***@myServer.com"
iMsg.To = "me@myServer.com"
iMsg.Subject = "Testing 123"
iMsg.Send()
Catch ex As Exception
Console.Write(ex)
Finally
End Try

I've got an error when execute the .Send() method:
System.Runtime.InteropServices.COMException (0x80040213): The transport
failed to connect to the server.
at CDO.MessageClass.Send()
at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e)

Both VB6 and VB.NET program are executed on the same XP machine without
exchange or outlook client is installed. I found that the VB.NET program can
be successfully executed on an XP machine WITH an outlook 2003 application
installed.

From MSDN, it seems that CDOSYS.DLL is target for exchange client installed?
is it true? but how come the VB6 program can be executed on XP machine
without exchange or outlook is installed (except outlook express)? Any
suggestion is appreciated!!

Thanks in advance!!
Martin


Oct 31 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.