Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CDO mail with no attachments
Message
De
22/12/2015 12:27:34
 
 
À
21/12/2015 19:01:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01629196
Message ID:
01629224
Vues:
49
Here is the send code.

This is driving me batty.

The .textbody property clearly has been populated, but it doesn't appear in the email

The subject and attachments appear, but not the body.
WITH This
  .ClearErrors()
  .oCfg = CREATEOBJECT("CDO.Configuration")
  .oMsg = CREATEOBJECT("CDO.Message")
  .oMsg.Configuration = This.oCfg
ENDWITH

&& Fill message attributes
LOCAL lnind, laList[1], loHeader, laDummy[1]

IF This.SetConfiguration() > 0
  This.AddError("Configuration Failure.")
ENDIF

IF This.GetErrorCount() = 0
  IF EMPTY(This.cFrom)
    This.AddError("ERROR : From is Empty.")
  ENDIF
  IF EMPTY(This.cSubject)
    This.AddError("ERROR : Subject is Empty.")
  ENDIF

  IF EMPTY(This.cTo) AND EMPTY(This.cCC) AND EMPTY(cBCC)
    This.AddError("ERROR : To,CC and BCC all are Empty.")
  ENDIF
ENDIF

IF This.GetErrorCount() = 0

  This.SetHeader()

  WITH This.oMsg

    .From     = This.cFrom
    .ReplyTo  = This.cReplyTo

    .To       = This.cTo
    .CC       = This.cCC
    .BCC      = This.cBCC
    .Subject  = This.cSubject

    *-- Clear attachements
    .Attachments.DeleteAll()

    *-- Clear Text Body
    .TextBody = ""

    *-- Clear HTML Body
    .HTMLBody = []

    && Create HTML body from external HTML (file, URL)
    IF NOT EMPTY(This.cHtmlBodyUrl)
      .CreateMHTMLBody(This.cHtmlBodyUrl)
    ENDIF

    && Send HTML body. Creates TextBody as well
    IF NOT EMPTY(This.cHtmlBody)
      .HtmlBody = This.cHtmlBody
    ENDIF

    && Send Text body. Could be different from HtmlBody, if any
    IF NOT EMPTY(This.cTextBody)
      .TextBody = This.cTextBody
    ENDIF
   
    .TextBody = "I plugged this"
    
    WAIT WINDOW .TextBody
    && Process attachments
    IF NOT EMPTY(This.cAttachment)
      && Accepts comma, semicolon
      FOR lnind=1 TO ALINES(laList, This.cAttachment, [,], [;])
        lcAttachment = ALLTRIM(laList[lnind])
        && Ignore empty values
        IF EMPTY(laList[lnind])
          LOOP
        ENDIF

        && Make sure that attachment exists
        IF ADIR(laDummy, lcAttachment) = 0
          This.AddError("ERROR: Attacment not Found - " + lcAttachment)
        ELSE
          && The full path is required.
          IF 	UPPER(lcAttachment) <> UPPER(FULLPATH(lcAttachment))
            lcAttachment = FULLPATH(lcAttachment)
          ENDIF
          .AddAttachment(lcAttachment)
        ENDIF
      ENDFOR
    ENDIF

  ENDWITH
ENDIF
IF This.GetErrorCount() = 0

  TRY
    This.oMsg.Send()
  CATCH TO oErr
    This.AddOneError("SEND ERROR: ", oErr.ErrorNo, oErr.procedure, oErr.LineNo)
  ENDTRY
ENDIF
RETURN This.GetErrorCount()
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform