Problem: need to preserve Customer's email signature in Outlook automation code. Tech: VFP9SP2 app using the latest Outlook client.
This is an update to the 8/21/2019 thread I started about using Outlook to create an email with file attachments. Got that code working (see below) but now need to find a way to preserve the customer's Outlook email signature. As the code is below, it creates a blank email and does NOT use their signature. I'm going to research this with fresh eyes tomorrow but wanted to throw this out in case others could chime in.
* start outlook LOCAL oOutlook as Outlook.Application, oNamespace as Outlook.NameSpace, oMailItem as Outlook.MailItem, lcFilename as String, lcRange as String, llOK as Logical, lcDir as String LOCAL oRecipient as Outlook.Recipient oOutlook = CREATEOBJECT("Outlook.Application") #DEFINE olFolderDisplayNormal 0 #DEFINE olMailItem 0 #DEFINE olCC 2 #DEFINE olBCC 3 #DEFINE olOriginator 0 #DEFINE olTo 1 oNameSpace = oOutlook.GetNameSpace("MAPI") oExplorer = oOutlook.Explorers.Add(oNameSpace.Folders[1],olFolderDisplayNormal) oMailItem = oOutlook.CreateItem(olMailItem) WITH oMailItem .Subject = ALLTRIM(this.txtSubject.Value) .Body = ALLTRIM(this.edtBody.Value) *** mjb 10/21/2019 - added defensive coding for L vs. N and empty too IF ((VARTYPE(this.chkEmail.Value)="L" AND this.chkEmail.Value) OR (VARTYPE(this.chkEmail.Value)="N" AND this.chkEmail.Value = 1)) AND NOT EMPTY(this.txtEmail.Value) THEN .Recipients.Add(ALLTRIM(this.txtEmail.Value)) ENDIF *** mjb 10/21/2019 - added CC IF ((VARTYPE(this.chkSRep.Value)="L" AND this.chkSRep.Value) OR (VARTYPE(this.chkSRep.Value)="N" AND this.chkSRep.Value = 1)) AND NOT EMPTY(this.txtSalesRepEmail.Value) THEN oRecipient = .Recipients.Add(ALLTRIM(this.txtSalesRepEmail.Value)) oRecipient.Type = olCC ENDIF * first add the built PDF from MergeDocuments above IF liCnt > 0 THEN .Attachments.Add(lcFile) ENDIF && liCnt > 0 * any non-PDFs to attach? SELECT curEmailThese SCAN FOR UPPER(JUSTEXT(cfilename)) <> "PDF" .Attachments.Add(ADDBS(ALLTRIM(curEmailThese.cpath))+ALLTRIM(curEmailThese.cfilename)) ENDSCAN
.Display() && Save() *.Send() ENDWITH