Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending HTML Emails using FOX
Message
From
08/05/2002 07:04:56
 
 
To
08/05/2002 04:53:50
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00653430
Message ID:
00653899
Views:
27
Hello Stephen.

Do you have any sample code that operates using this mechanism.

First of all, let me qualify a few things here: I am talking about the versions of CDP that ship with Win2K and later that are found in CdoSys.dll or CdoEx.dll. The earlier versions of CDO (v 1.2.1 ) are MAPI based, and so will not solve your problem.

Also, the easiest way to make sure that you have the correct configuration information in order to send the message is to make sure that Outlook Express is installed on the machines. If Outlook Express is not installed, you have to manually configure it.

Here is some code to get you started:
#DEFINE cdoSendEmailAddress    "http://schemas.microsoft.com/cdo/configuration/sendemailaddress"  

LPARAMETERS toParms
WITH This
  *** create configuration and message objects
  .oConfig = CREATEOBJECT( 'CDO.Configuration' )
  *** Check to see if we have configuration infomation
  IF NOT EMPTY( NVL( .oConfig.Fields( "http://schemas.microsoft.com/cdo/configuration/smtpserver").value, "" ) )   ELSE
    *** Manually set Configuration properties
    *** using the CdoConfig table
    This.GetSmtpInfo()
  ENDIF
  .oMsg = CREATEOBJECT( 'CDO.Message' )
  WITH .oMsg
    .Configuration = This.oConfig
    *** See if we have a sender address. 
    *** If we manually loaded the config, we may not
    IF EMPTY( NVL( .From, "" ) )
      .From = .Configuration.Fields( cdoSendEmailAddress ).value
    ENDIF
    .To = ALLTRIM( toParms.cTo )
    .CC = ALLTRIM( toParms.cCC )
    .Bcc = ALLTRIM(toParms.cBcc )
    .Subject = ALLTRIM( toParms.cSubject )
    *** See if we are sending a web page in the body of the message
    IF NOT EMPTY( toParms.cURL )
      .CreateMHTMLBody( ALLTRIM( toParms.cURL ) )
    ENDIF
    *** Add any message text to the beginning of the body
    .HTMLBody = toParms.cHTMLBody + .HTMLBody 
    *** Add any attachments
    IF NOT EMPTY( toParms.aAttachments[ 1 ] )
      lnLen = ALEN( toParms.aAttachments, 1 )
      FOR lnCnt = 1 TO lnLen
        .AddAttachment( ALLTRIM( toParms.aAttachments[ lnCnt ] ) )
      ENDFOR
    ENDIF
    .Send()
  ENDWITH
ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform