Well that answer sounds like the obvious easy answer but I kinda thought that using this component was all for a seamless emailing and did not have a visible component.  I'll test that out and report back.  Basically, I thought there was no visible email client with this approach?

On 8/21/2019 5:35 PM, Richard Kaye wrote:
So maybe make the loMsg object visible and don’t invoke the Send() method?

--

rk

-----Original Message-----
From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of MB Software 
Solutions, LLC
Sent: Wednesday, August 21, 2019 5:31 PM
To: profoxt...@leafe.com
Subject: Re: Easiest/best way to create an email using local MS Outlook with 
file attachments?

Hi John,

Thanks for your code below.  It's pretty much exactly what I use for my bug 
reporting where the app automatically sends an email. However, in this case, 
the customer WANTS to see it in Outlook and review it themselves before 
pressing the Send button to email it. (Paranoia?)

Thanks though.

On 8/21/2019 11:19 AM, John Weller wrote:
As promised. This example uses a Gmail account.

        lcErr = ""
        lcSchema = "http://schemas.microsoft.com/cdo/configuration/";
        loConfig = CREATEOBJECT("CDO.Configuration")
        WITH loConfig.FIELDS
                .ITEM(lcSchema + "smtpserver") = "smtp.gmail.com"
                .ITEM(lcSchema + "smtpserverport") = 465 && 465 or 587
                .ITEM(lcSchema + "sendusing") = 2
                .ITEM(lcSchema + "smtpauthenticate") = .T.
                .ITEM(lcSchema + "smtpusessl") = .T.
                .ITEM(lcSchema + "sendusername") = lcUserName
                .ITEM(lcSchema + "sendpassword") = lcPassword
                .UPDATE
        ENDWITH
        loMsg = CREATEOBJECT ("CDO.Message")
        WITH loMsg
                .Configuration = loConfig
                .FROM = lcFrom
                .TO = lcTo
                IF NOT EMPTY(lcCC)
                        .CC = lcCC
                ENDIF
                IF NOT EMPTY(lcBCC)
                        .BCC = lcBCC
                ENDIF   
                .Subject = lcSubject
                .TextBody = lcText
                IF NOT EMPTY(lcAttach1)
                        .AddAttachment(lcAttach1)
                ENDIF
                IF NOT EMPTY(lcAttach2)
                        .AddAttachment(lcAttach2)
                ENDIF
                
                .Send()
                
        ENDWITH

HTH

John

John Weller
01380 723235
07976 393631

-----Original Message-----
From: ProfoxTech <profoxtech-boun...@leafe.com> On Behalf Of MB
Software Solutions, LLC
Sent: 21 August 2019 05:22
To: profoxt...@leafe.com
Subject: Easiest/best way to create an email using local MS Outlook with file 
attachments?

VFP9SP2 app

Customer uses Outlook and wants the app to generate an email to a given email address 
from the app AND attach certain documents to it.  Customer will preview it and then 
manually hit "Send" on their own.

What's the BEST (and hopefully easiest) way to implement this? Invoke Outlook 
via CREATEOBJECT and set properties and attachments accordingly?  Typically in 
the past I've used MAILTO and ShellExec but this time the extra requirement is 
to have files attached from the application too, which makes MAILTO not an 
option, if I understand correctly.

tia,
--Mike



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/22502d2b-c346-23f5-2bae-b54af680b...@mbsoftwaresolutions.com
** 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.

Reply via email to