Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CDO mail with no attachments
Message
From
21/12/2015 19:01:08
 
 
To
21/12/2015 18:53:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01629196
Message ID:
01629202
Views:
41
>>>I have a client app that sends hundreds of CDO emails a day.
>>>
>>>All of them include .pdf attachments.
>>>
>>>Recently, a case arose that requires body text, but no attachment.
>>>
>>>The email goes out OK but there's no body text.
>>>
>>>Here's the code
>>>
>>>PARAMETERS pc_attachmentname, pc_subject, ;
>>>      pc_mailtext, pc_addresslist
>>>
>>>
>>>loMail = NEWOBJECT("lf_cdomail","cdomaillib")
>>>WITH loMail
>>>  *-- Create error collection
>>>  .oErrors = CREATEOBJECT("Collection")
>>> 
>>>  .cServer = oApp.gc_smtpserver
>>>  .nServerPort = oApp.ln_cdoserport
>>>  *-- Use SSL connection
>>>  .lUseSSL = oApp.ll_cdousessl
>>>  .nConnectionTimeout = oApp.ln_cdotimeout && Default 30 sec's
>>>  *-- Do not use cache for cHtmlBodyUrl
>>>  .lURLGetLatestVersion = oApp.ll_cdogetver
>>>  *-- Use SMTP Server Port
>>>  .nSendUsingPort = oApp.ln_cdouseport
>>>
>>>  *-- The following lines are required
>>>  * 	if your SMTP server requires basic authentication
>>>  .nAuthenticate = oApp.ln_cdoauthen
>>>  
>>>  .cUserName = oApp.gc_smtpuser 
>>>  .cPassword = oApp.gc_smtppass
>>>  .cFrom =  oApp.gc_smtpfrom 
>>>
>>>  *-- Use use testaddr for mail testing
>>>  IF  oApp.gl_mailtest 
>>>   .cTo = oApp.gc_testaddr
>>>  ELSE
>>>    .cTo = pc_addresslist
>>>  ENDIF
>>>  .cCC = ""
>>>  .cBCC = ""
>>>  .cHtmlBody = ""
>>>
>>>  .cAttachment = ""
>>>
>>>  *-- Attachments are optional Comment this line out if there are no attachments
>>>  IF NOT EMPTY(pc_attachmentname)
>>>    .cAttachment =  pc_attachmentname
>>>  ENDIF
>>>  .cSubject = pc_subject
>>>
>>>  && Uncomment next lines to send HTML body
>>>  &&.cHtmlBody = "<html><body><b>This is an HTML body<br> It'll be displayed by most email clients</b></body></html>"
>>>
>>>  .cTextBody = pc_mailtext
>>>  
>>>   IF loMail.Send() <> 0
>>>     DO notice WITH "Mail Sending Error"
>>>   ENDIF
>>>ENDWITH
>>>
>>
>>What is cdomaillib.vcx/lf_cdomail.Send() doing?
>
>Al
>That's the code I included here.

Doesn't look like it to me.

With the call
loMail = NEWOBJECT("lf_cdomail","cdomaillib")
loMail is created as an instance of the lf_cdomail class in the cdomaillib.vcx class library. I'm guessing that's some sort of wrapper class for various CDO mail functions.

Near the bottom, loMail.Send() is being called. So that's effectively calling lf_cdomail.Send().

Have you examined that class.code to see what it's doing?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform