Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CDO mail with no attachments
Message
De
21/12/2015 18:43:05
 
 
À
21/12/2015 17:48:37
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:
01629200
Vues:
49
>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?
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform