Kurt,
you could be correct that send(.t.) may just send it. I do have some code that uses it to display the message prior to it being sent, but looking back at the code now, it is referring to a messages object, not a mailitem as in Mike's code, so maybe there is a difference but it's easy enough to try it out.
Frank.
Frank Cazabon
On 03/09/2019 07:14 PM, Kurt at VR-FX wrote:
Frank - I think what you suggested would Send it. He simply wants it on the screen to view. I think its possible that the window is Hidden some how. Must be a way to place it on top.
I've done this kinda stuff in the past - using the same book at examples in it. But, I'm confounded at the "Explorer" references in your code Mike!
FYI - I believe there is a ".Visible" option that you must use somewhere in your code - and THAT may make the email visible to use for viewing before sending! Just a WAG here...
Again - its been YEARS since I did the Office Auto. stuff!
-K-
On 9/3/2019 2:41 PM, Frank Cazabon wrote:
Off the top of my head (and is been a long time since I did this) but try passing true to the send (.t.) I think that might display the email ready to be sent.
On 3 September 2019 16:53:17 GMT-04:00, "MB Software Solutions, LLC" mbsoftwaresolutions@mbsoftwaresolutions.com wrote:
I have a need to use MAPI (yes, I know Ted et al: MAPI bad, SMTP good...but this customer wants to see a system generated email in Outlook, review it including file attachment, and then press Send manually). I thought I was going to have to use the Redemption tool to
get around the security issues with Outlook but I'm stunned that this simple code worked on my laptop which has Outlook 2016 on it:
LOCAL oOutlook as Outlook.Application, oNamespace as Outlook.NameSpace,
oMailItem as Outlook.MailItem oOutlook = CREATEOBJECT("Outlook.Application") #DEFINE olFolderDisplayNormal 0 #DEFINE olMailItem 0 oNameSpace = oOutlook.GetNameSpace("MAPI") oExplorer = oOutlook.Explorers.Add(oNameSpace.Folders[1],olFolderDisplayNormal) oMailItem = oOutlook.CreateItem(olMailItem) WITH oMailItem .Subject = 'Testing email send' .Body = "Thank you for your participation in the test at " + TTOC(DATETIME()) .Recipients.Add("mbabcock@mbsoftwaresolutions.com") .Attachments.Add("C:\crap\MyFile.pdf") .Save() *.Send() && commented out for now as I don't want to auto-send...user wants to review and manually Send ENDWITH
oExplorer.Activate()
This is basically using the code from the Microsoft Office Automation with Visual FoxPro book from HWP. (Thanks for the cue, Ted!). Now the
comment and question:
- I'm amazed that Outlook 2016 let me do this without any
warning/blocking. I was thinking I'd have to use the Outlook Redemption add-in tool (http://www.dimastr.com/redemption/) 2. The sample code above saves it to the Drafts folder but when I open OL via the last line (oExplorer.Activate()), I was hoping to have the email front and center so the user could just press the Send button after reviewing it manually on screen. Any ideas how to achieve that?
tia, --Mike
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
Post Messages to: ProFox@leafe.com Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: https://leafe.com/archives This message: https://leafe.com/archives/byMID/f7d9c573-16a6-b737-9aaa-f288fa11226e@mbsoft...
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious. Report [OT] Abuse: http://leafe.com/reportAbuse/f7d9c573-16a6-b737-9aaa-f288fa11226e@mbsoftware...
[excessive quoting removed by server]