Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get CDO Message attachments contents
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00799089
Message ID:
00799540
Vues:
30
>Tks for the help
>
>Finally I found a description of the IBodyPart Interface
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_ibodypart_fields.asp
>
>Marcel

Here's some more BodyPart stuff for your collection:

(See message #782057 for the SMTPConfig code)
LPARAMETERS  ;
  tcText,    ;
  tcHTML,    ;
  tcSubject, ;
  tcMessage, ;
  tcFrom,    ;
  tcTo

* CDO message hierarchy
WITH CREATEOBJECT([CDO.Message]) &&---------------------------------------------&&
  * BodyParts hierarchy                                                         &&
  WITH .BodyPart &&---------------------------------------------------------&&  &&
    * Set the header fields                                                 &&  &&
    .ContentMediaType = [multipart/mixed]                                   &&  &&
                                                                            &&  &&
    * Message BodyPart                                                      &&  &&
    WITH .AddBodyPart &&------------------------------------------------&&  &&  &&
      * TextBody                                                        &&  &&  &&
      WITH .AddBodyPart() &&----------------------------------------&&  &&  &&  &&
        * Set the header fields                                     &&  &&  &&  &&
        .ContentMediaType        = [text/plain; charset="US-ASCII"] &&  &&  &&  &&
        .ContentTransferEncoding = [quoted-printable]               &&  &&  &&  &&
                                                                    &&  &&  &&  &&
        * Set the text                                              &&  &&  &&  &&
        WITH .GetDecodedContentStream()                             &&  &&  &&  &&
          .WriteText(tcText)                                        &&  &&  &&  &&
          .Flush()                                                  &&  &&  &&  &&
        ENDWITH                                                     &&  &&  &&  &&
      ENDWITH &&----------------------------------------------------&&  &&  &&  &&
                                                                        &&  &&  &&
      * HTMLBody                                                        &&  &&  &&
      WITH .AddBodyPart() &&----------------------------------------&&  &&  &&  &&
        * Set the header fields                                     &&  &&  &&  &&
        .ContentMediaType        = [text/html; charset="US-ASCII"]  &&  &&  &&  &&
        .ContentTransferEncoding = [quoted-printable]               &&  &&  &&  &&
                                                                    &&  &&  &&  &&
        * Set the text                                              &&  &&  &&  &&
        WITH .GetDecodedContentStream()                             &&  &&  &&  &&
          .WriteText(tcHTML)                                        &&  &&  &&  &&
          .Flush()                                                  &&  &&  &&  &&
        ENDWITH                                                     &&  &&  &&  &&
      ENDWITH &&----------------------------------------------------&&  &&  &&  &&
                                                                        &&  &&  &&
      * This may appear out of order, but we have to set the            &&  &&  &&
      * content-type for the "multipart/alternative" body part          &&  &&  &&
      * AFTER adding the two representations. If we'd done it           &&  &&  &&
      * before, it would've been switched to "multipart/mixed"          &&  &&  &&
      * for us as soon as we made the first AddBodyPart() call          &&  &&  &&
      .ContentMediaType = [multipart/alternative]                       &&  &&  &&
    ENDWITH &&----------------------------------------------------------&&  &&  &&
                                                                            &&  &&
    * Attachment BodyPart (of type 'message')                               &&  &&
    WITH .AddBodyPart() &&------------------------&&                        &&  &&
      * Set the header fields                     &&                        &&  &&
      .ContentMediaType        = [message/rfc822] &&                        &&  &&
      .ContentTransferEncoding = [7bit]           &&                        &&  &&
                                                  &&                        &&  &&
      * Add the attachment                        &&                        &&  &&
      WITH .GetDecodedContentStream()             &&                        &&  &&
        .WriteText(tcMessage)                     &&                        &&  &&
        .Flush()                                  &&                        &&  &&
      ENDWITH                                     &&                        &&  &&
    ENDWITH &&------------------------------------&&                        &&  &&
                                                                            &&  &&
    * Attachment BodyPart (of type 'text')                                  &&  &&
    WITH .AddBodyPart() &&------------------------------------&&            &&  &&
      * Set the header fields                                 &&            &&  &&
      .ContentMediaType        = [text/plain; name="msg.txt"] &&            &&  &&
      .ContentTransferEncoding = [7bit]                       &&            &&  &&
                                                              &&            &&  &&
      * Add the attachment                                    &&            &&  &&
      WITH .GetDecodedContentStream()                         &&            &&  &&
        .WriteText(tcMessage)                                 &&            &&  &&
        .Flush()                                              &&            &&  &&
      ENDWITH                                                 &&            &&  &&
    ENDWITH &&------------------------------------------------&&            &&  &&
  ENDWITH &&----------------------------------------------------------------&&  &&
                                                                                &&
  * Set the main message headers                                                &&
  .Configuration = This.SMTPConfig(cdoSendUsingPort)                            &&
  .Subject       = tcSubject                                                    &&
  .From          = tcFrom                                                       &&
  .To            = tcTo                                                         &&
                                                                                &&
  * Send the message                                                            &&
  .Send()                                                                       &&
ENDWITH &&----------------------------------------------------------------------&&

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

Click here to load this message in the networking platform