Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is the cdo.dll I have to use with windows XP?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00781394
Message ID:
00782057
Vues:
28
Hi Juan

You have to be running WinXP Pro, and you'll need to install the SMTP Service using Add/Remove Programs\Windows Components\Internet Information Services. You may be prompted for your WinXP installation CD.

Once it's installed, you can access the CDO model:
  loMessage = CREATEOBJECT("CDO.Message")
If you've got FrontPage Server Extensions installed as well, though, you'll run into a hitch -- you'll most likely get an error message when you call loMessage.Send()
  OLE IDispatch exception code 0 from CDO.Message.1: The
  "SendUsing" configuration value is invalid.
This is because FPSE mucks things up sufficiently that you have to set the mail message's Configuration object, like so:
  #DEFINE cdoSendUsingPickup 1
  #DEFINE cdoSendUsingPort   2

  WITH CREATEOBJECT("CDO.Message")
    .Configuration = SMTPConfig(cdoSendUsingPickup)
    .TextBody      = "This is a testy message..."
    .To            = "You <you@yourplace.com>"
    .From          = "Me <me@myplace.com>"
    .Subject       = "Test Message"

    .Send()
  ENDWITH

  FUNCTION SMTPConfig(tiSendMethod, tcSMTPServer)
    LOCAL loSMTPConfig
    LOCAL lcSMTPServer
    LOCAL lcConfigURL

    lcSMTPServer = IIF(EMPTY(tcSMTPServer), "localhost", tcSMTPServer)
    lcConfigURL  = "http://schemas.microsoft.com/cdo/configuration/"
    loSMTPConfig = CREATEOBJECT("CDO.Configuration")

    WITH loSMTPConfig.Fields
      IF tiSendMethod = cdoSendUsingPickup
        * Send using the Pickup directory
        .Item(lcConfigURL + "smtpserverpickupdirectory") = ;
          "C:\InetPub\MailRoot\"
      ELSE
        * Send using the SMTP port
        .Item(lcConfigURL + "smtpserverport") = 25
        .Item(lcConfigURL + "smtpserver")     = lcSMTPServer
      ENDIF

      .Item(lcConfigURL + "sendusing") = tiSendMethod
      .Update()
    ENDWITH

    * Return the configuration
    RETURN loSMTPConfig
  ENDFUNC
HTH,
Jeff

Read about the greatest fraud in the history of mankind.
See TaxableIncome.net.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform