Issue on send mail by using CDOSYS.DLL

A

Atenza

Hi,

I am not sure if this is the best group for this problem, but here goes.

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 = "(e-mail address removed)"
.From = "(e-mail address removed)"
.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 = "(e-mail address removed)"
iMsg.To = "(e-mail address removed)"
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top