• Welcome to Theos PowerBasic Museum 2017.

Re: CDO: Collaboration Data Objects

Started by Elias Montoya, December 02, 2008, 02:44:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hank Zucker

Hi José,

I followed your suggestion and get

80040213

at the command prompt.  But I do not know what that means.

Best regards,
Hank

Hank Zucker

Hi José,

Additional info:

I moved the TRY to isolate the problem, and it occurs at the iMsg.Send step.

Best regards,
Hank

José Roca

You can find the CDO error codes in the file CDOEXERR.INC and in this Microsoft page: http://msdn.microsoft.com/en-us/library/ms526287(EXCHG.10).aspx

Error 80040213 (%CDO_E_FAILED_TO_CONNECT):
The transport failed to connect to the server.

Hank Zucker

Hi José,

Thanks for the additional info.

I tried using my gmail account and now get:

  Error 80040211 (CDO_E_SMTP_SEND_FAILED)
  "The message could not be sent to the SMTP server. The transport error code was %2. The server response was %1"

How do I find out what %2 and %1 are?

Can you please give me the exact code you used when successfully using your gmail account, with only your account name and password changed?  I tried using your earlier example code when I got the above error.

Thanks again!

Hank

José Roca

Quote
How do I find out what %2 and %1 are?

If you use my wrapper function OleGetErrorInfo, as in the example below, it will display a full description as returned by the provider.

Quote
Can you please give me the exact code you used when successfully using your gmail account, with only your account name and password changed?  I tried using your earlier example code when I got the above error.

Here is the code:


#COMPILE EXE
#DIM ALL
#INCLUDE ONCE "windows.inc"
#INCLUDE ONCE "cdosys.inc"
#INCLUDE ONCE "ado.inc"
#INCLUDE ONCE "ole2utils.inc"

FUNCTION PBMAIN () AS LONG

   DIM iMsg AS CDO_IMessage
   DIM iConf AS CDO_IConfiguration
   DIM Flds AS ADOFields

   iMsg = NEWCOM "CDO.Message"
   iConf = NEWCOM "CDO.Configuration"

   TRY

      Flds = iConf.Fields
      DIM schema AS STRING
      schema = "http://schemas.microsoft.com/cdo/configuration/"
      Flds.Item(schema & "sendusing").Value = 2
      Flds.Item(schema & "smtpserver").Value = "smtp.gmail.com"
      Flds.Item(schema & "smtpserverport").Value = 465
      Flds.Item(schema & "smtpauthenticate").Value = 1
      Flds.Item(schema & "sendusername").Value = "mymail@gmail.com"
      Flds.Item(schema & "sendpassword").Value =  "mypassword"
      Flds.Item(schema & "smtpusessl").Value = 1
      Flds.Update

      iMsg.To = UCODE$("my first email address")
      iMsg.From = UCODE$("José Roca <my 2nd email address>")
      iMsg.Subject = UCODE$("Test send with gmail account")
      iMsg.HTMLBody = UCODE$("Test send with gmail account")
      iMsg.Sender = UCODE$("José Roca")
      iMsg.Organization = UCODE$("José Roca")
      iMsg.ReplyTo = UCODE$("José Roca <my 2nd email address>")
      iMsg.Configuration = iConf
      iMsg.Send
      ? "Message sent successfully"
   CATCH
      ? OleGetErrorInfo(OBJRESULT)
   END TRY

   iMsg = NOTHING
   iConf = NOTHING
   Flds = NOTHING

END FUNCTION