I have automated a WorkGroup application that generates an Outlook 365 ( client ) e-mail ... the code is simple enough and it works quite well .. however I am having problems with some users that can not see the Body ( cBody ) of the message .. which I code as plain text ...
Here is the code:
- Code: Select all Expand view RUN
cBody := "Dear Employee: "+alltrim( cEMployee )+";"+chr(10)
cBody += "From "+cMan1+" "+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += "A Travel / Train request has been reviewed and Approved by "+alltrim(cMan1)+"."+chr(10)
cBody += "The Final Disposition : "+cCloseType+" Dated "+dtoc(dFinalDt)+"."+chr(10)
cBody += " "+chr(10)
cBody += "Please see the Link instructions Provided below. ** "+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += "Summary of Request:"+chr(10)
cBody += " "+chr(10)
cBody += " * Employee Name: "+alltrim( cEmployee )+chr(10)
cBody += " * Vendor Sponsor: "+alltrim( cSponsor )+chr(10)
cBody += " * Conference/Event: "+alltrim( cEvent )+chr(10)
cBody += " * Location: "+alltrim( cLocation )+chr(10)
cBody += " * Start Date: "+dtoc( dLeave )+chr(10)
cBody += " * End Date: "+dtoc( dReturn )+chr(10)
cBody += " * Estimated Cost: $"+Transform(nTotalExp,"999,999.99" )+chr(10)
If cExam = "Y" .and. ( cQuality = "N" .and. cMgmt = "N" .and. cTech = "N" .and. cDev = "N" .and. cConf = "N" )
cBody += " * Is this Request for Examination Travel ONLY? : Yes"+chr(10)
Else
cBody += " * Is this Request for Examination Travel ONLY? : No"+chr(10)
Endif
cBody += " * Is This Associated with a Previously approved Designation? : "+cPrevAppr+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += alltrim(cAppUrl)+" /"+alltrim( cPersno )+chr(10)
cBody += " "+chr(10)
cBody += "** To run .. hold down the Windows key + R ... "+chr(10)
cBody += "Cut and Paste the entire link above into the open RUN line and hit"+chr(10)
cBody += "OK to start the Program"+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += " "+chr(10)
cBody += "Note .. This is an automated e-mail sent from the Leave / Travel Program"+chr(10)
cBody += " "+chr(10)
Not rocket science so far ....
Here is my Outlook "silent" e-mail generation ....
- Code: Select all Expand view RUN
Try
oOutLook := TOleAuto():New("Outlook.Application")
Catch
Saying := "For some Odd reason The Outlook e-mail CLient failed to Initialize"
Msginfo( Saying )
Return(.f.)
End Try
oMailItem := oOutLook:Invoke("CreateItem", 0)
oMailitem:to := cTo
oMailitem:CC := cCC
oMailItem:Subject := cSubject
oMailItem:Body := cBody // just plain text
Try
oMailItem:display(.F.)
Catch
End Try
Try
oMailItem:Invoke("Send")
Catch
End Try
The e-mail is generated and sent to the recipient .. however, in a couple of cases .. cBody is not being resolved in the e-mail .. just a big white space .. By default all the OUtlook settings are set to allow HTML .... even the ones that DO recieve the message where cBody is just plain text ...
I am just curious if chr(10) at the end of the text may be causing any problems .. however, only a select few recipients have any problem at all seeing the body of the message ... I am just curious if changing cBody to HTML may be a ( positive ) common denominator ...
I would be grateful if any HTML Gurus could look at cBody and re-code it for HTML ??? however, I don't know if HTML vs plain text will resolve anything .. I am OPEN to any comments and suggestions ...
Thanks
Rick Lipkin