Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-22 Thread Alan Bourke
The thing about CDO is that it's deprecated by Microsoft and not supported on 
anything after Outlook 2010 as far as I can tell.

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

___
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/58f4c972-6293-4447-80bc-1b9631f6e...@www.fastmail.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.


RE: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-22 Thread Richard Kaye
Always start with the simplest solution is my motto...  

I've never automated CDO objects so don't have a clue. Should be easy enough to 
find out if the message object has a UI. If not, you'd need to go with 
automating Outlook instead of using CDO. 

--

rk

-Original Message-
From: ProfoxTech  On Behalf Of MB Software 
Solutions, LLC
Sent: Thursday, August 22, 2019 12:32 AM
To: profoxt...@leafe.com
Subject: Re: Easiest/best way to create an email using local MS Outlook with 
file attachments?

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  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  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.
Report [OT] Abuse: 
http://leafe.com/reportAbuse/22502d2b-c346-23f5-2bae-b54af680b...@mbsoftwaresolutions.com
___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of 

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread MB Software Solutions, LLC
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  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  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.

RE: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Richard Kaye
So maybe make the loMsg object visible and don’t invoke the Send() method?

--

rk

-Original Message-
From: ProfoxTech  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  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/8ea12cd3-ac5d-950d-bdbf-eb041e691...@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.
Report [OT] Abuse: 
http://leafe.com/reportAbuse/8ea12cd3-ac5d-950d-bdbf-eb041e691...@mbsoftwaresolutions.com
___
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/bn6pr10mb1458b472a3392d19c35b05d4d2...@bn6pr10mb1458.namprd10.prod.outlook.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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread MB Software Solutions, LLC

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  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/8ea12cd3-ac5d-950d-bdbf-eb041e691...@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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread MB Software Solutions, LLC

On 8/21/2019 9:58 AM, Malcolm Greene wrote:

Michael,

A better option than Outlook (ugh!): Check out SendGrid (now part of Twilio).



Hi Malcolm,

But this customer--who uses Outlook currently--wants the email "prepped, 
ready, and shown" in Outlook so they can review and just press the Send 
button.  Otherwise, yeah, I'd probably go a different way!  ;-)




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


___
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/f42c9f6f-c49b-6289-3ab4-726843daa...@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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread MB Software Solutions, LLC
Yes, thanks...spec calls for user to review everything and they have the 
responsibility to press Send...the app will not auto-send it.


On 8/21/2019 7:40 AM, Frank Cazabon wrote:

Mike,

along with Alan's code you can use loMsg.Display() to display the 
email on screen before sending.


Frank.

Frank Cazabon

On 21/08/2019 04:17 AM, Alan Bourke wrote:

If you want to use Outlook:

loOutlook=CreateObject("Outlook.Application")
loMsg = loOutlook.CreateItem(0)
loMsg.BodyFormat= 2 && olFormatHTML
loMsg.HtmlBody="HTML body text"
loMsg.Body = "Plain body text for clients without HTML mail support."
loMsg.Subject="Subject"
loMsg.Recipients.Add("some...@somewhere.com")
loMsg.Recipients.Add("some...@anotherplace.com")
loMsg.Attachments.Add("attach1.txt", 1)
loMsg.Attachments.Add("attach2.txt", 1)
loMsg.Attachments.Add("attach3.txt", 1)

Try
 llSent = loMsg.Send()
Catch to loException
 && handle it
Finally
 release loMsg
 release loOutlook
Endtry

HOWEVER

There are some drawbacks to this.

- Despite it sending via Outlook, you will find that any Outlook 
signatures or stationery that would normally apply won't get used on 
the programmatically created message.


- You may find that the dread Outlook security message ('A program is 
trying to send mail on your behalf...') will crop up, depending on 
Outlook and Exchange Server version.







[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/067d0afe-8feb-8fd3-47d5-b19672a50...@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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread MB Software Solutions, LLC

This client is using OUTLOOK, not Gmail.


On 8/21/2019 3:10 AM, Koen Piller wrote:

If your client is not using Gmail than VFPWinsock is the easiest app to
mail with attachments
Koen


Op wo 21 aug. 2019 om 08:58 schreef John Weller 


I use CDO to do just that. I’m not in the office until later today but
when I get in I’ll send you some sample code if you wish?

John

John Weller
01380 723235
079763 93631
Sent from my iPad


On 21 Aug 2019, at 05:22, MB Software Solutions, LLC <

mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote:

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/bbc9d4b9-9185-f520-390f-6e1c61f33...@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.

RE: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread John Weller
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  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/002601d55833$c9678a00$5c369e00$@johnweller.co.uk
** 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.


Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Malcolm Greene
> SendGrid, MailJet et al are definitely the way to go for bulk emailing, 
> however are possibly overkill for sending occasional one-off messages from an 
> application, which is what I took the requirement to be. "I'm already paying 
> for Office 365, why am I paying for SendGrid on top to send a few emails?"

SendGrid free plan covers 100 emails/day.

Malcolm

___
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/9b9fb2f3-085e-4939-b3b0-45bf5efcf...@www.fastmail.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.


Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Alan Bourke
> A better option than Outlook (ugh!): Check out SendGrid (now part of Twilio).


SendGrid, MailJet et al are definitely the way to go for bulk emailing, however 
are possibly overkill for sending occasional one-off messages from an 
application, which is what I took the requirement to be.

"I'm already paying for Office 365, why am I paying for SendGrid on top to send 
a few emails?"

-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

___
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/d8816e3c-4a08-4b0a-a86e-3ded2bdf9...@www.fastmail.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.


RE: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Richard Kaye
I feel better now... 

--

rk

-Original Message-
From: ProfoxTech  On Behalf Of Ted Roche
Sent: Wednesday, August 21, 2019 9:37 AM
To: profoxt...@leafe.com
Subject: Re: Easiest/best way to create an email using local MS Outlook with 
file attachments?


And remember, kids, MAPI Bad! SMTP Good. Just Say No. We Can Eliminate It In 
Our Lifetimes.

___
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/bn6pr10mb1458effd3fdb7ef521e783ced2...@bn6pr10mb1458.namprd10.prod.outlook.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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Malcolm Greene
Michael,

A better option than Outlook (ugh!): Check out SendGrid (now part of Twilio).

Malcolm

___
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/dd267b5b-f5ff-49f6-bf15-0c4ff0c3d...@www.fastmail.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.


Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Ted Roche
On Wed, Aug 21, 2019 at 12:22 AM MB Software Solutions, LLC <
mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote:

> 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.
>

Despite its advanced age (16!) this paper still has a few good pointers in
it:

https://www.tedroche.com/Present/2003/OutlookAutomation.html

"However, just because you can do something doesn't mean that you should. "
made me laugh.

The canonical reference is Office Automation with Visual FoxPro by Tamar E.
Granor and Della Martin, edited by yours truly, and more info can be found
at:

http://hentzenwerke.com/catalog/autofox.htm

Note that there are sample chapters and downloads available. The site says
"Out of Print" but I think the ebook may still be order-able.

Bear in mind that MSFT regularly changes and breaks their APIs, or the
mechanism to access the APIs, since skript kiddies regularly take over
Outlook and use it to send spam and perpetrate identity theft. Just in the
last month's patches, they broke portions of VB6, VBA and VBScript. I
shipped a number of apps with Office Automation back in the day, and
between Office object model changes and security enhancements required some
major rewriting, sometimes sprung on us by surprise. It was a learning
experience in how Microsoft supports developers of their products.

Rather than tightly coupling your VFP app with this week's version of
Outlook, you might consider how an arm's length relationship could work out
better for all involved. You could use WestWind Client Tools, BLAT, or
command-line mail tools [1] to draft the message and send it to the
customer, who could review it and forward it to the client, with the
downside they would need to specify the forwarding address, or you could
write a .NET app integrated into Outlook that could read a queue written
into a database table by FoxPro and do the automation and processing in
.NET.

And remember, kids, MAPI Bad! SMTP Good. Just Say No. We Can Eliminate It
In Our Lifetimes.

Good luck!

[1] I also wrote a white paper "Email Without Outlook" for this very
reason: https://www.tedroche.com/Present/2002/emailwooutlook.html

-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
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/CACW6n4vnOj5KqWdiha55mAt=Fv+w9HibSCLznMw=vtay2-q...@mail.gmail.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.


Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Frank Cazabon

Mike,

along with Alan's code you can use loMsg.Display() to display the email 
on screen before sending.


Frank.

Frank Cazabon

On 21/08/2019 04:17 AM, Alan Bourke wrote:

If you want to use Outlook:

loOutlook=CreateObject("Outlook.Application")
loMsg = loOutlook.CreateItem(0)
loMsg.BodyFormat= 2   
&& olFormatHTML
loMsg.HtmlBody="HTML body text"
loMsg.Body = "Plain body text for clients without HTML mail support."
loMsg.Subject="Subject"
loMsg.Recipients.Add("some...@somewhere.com")
loMsg.Recipients.Add("some...@anotherplace.com")
loMsg.Attachments.Add("attach1.txt", 1)
loMsg.Attachments.Add("attach2.txt", 1)
loMsg.Attachments.Add("attach3.txt", 1)

Try
 llSent = loMsg.Send()
Catch to loException
 && handle it
Finally
 release loMsg
 release loOutlook
Endtry

HOWEVER

There are some drawbacks to this.

- Despite it sending via Outlook, you will find that any Outlook signatures or 
stationery that would normally apply won't get used on the programmatically 
created message.

- You may find that the dread Outlook security message ('A program is trying to 
send mail on your behalf...') will crop up, depending on Outlook and Exchange 
Server version.





___
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/846fca74-7d65-c745-5c26-51197748a...@gmail.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.


Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Alan Bourke
If you want to use Outlook:

loOutlook=CreateObject("Outlook.Application")
loMsg = loOutlook.CreateItem(0)
loMsg.BodyFormat= 2   
&& olFormatHTML
loMsg.HtmlBody="HTML body text"
loMsg.Body = "Plain body text for clients without HTML mail support."
loMsg.Subject="Subject"
loMsg.Recipients.Add("some...@somewhere.com")
loMsg.Recipients.Add("some...@anotherplace.com")
loMsg.Attachments.Add("attach1.txt", 1)
loMsg.Attachments.Add("attach2.txt", 1)
loMsg.Attachments.Add("attach3.txt", 1)

Try
llSent = loMsg.Send()
Catch to loException
&& handle it
Finally
release loMsg
release loOutlook
Endtry

HOWEVER

There are some drawbacks to this. 

- Despite it sending via Outlook, you will find that any Outlook signatures or 
stationery that would normally apply won't get used on the programmatically 
created message. 

- You may find that the dread Outlook security message ('A program is trying to 
send mail on your behalf...') will crop up, depending on Outlook and Exchange 
Server version.



-- 
  Alan Bourke
  alanpbourke (at) fastmail (dot) fm

On Wed, 21 Aug 2019, at 5:22 AM, MB Software Solutions, LLC wrote:
> 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/b041d48b-be2d-452f-94e7-595cf4541...@www.fastmail.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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Koen Piller
If your client is not using Gmail than VFPWinsock is the easiest app to
mail with attachments
Koen


Op wo 21 aug. 2019 om 08:58 schreef John Weller 

> I use CDO to do just that. I’m not in the office until later today but
> when I get in I’ll send you some sample code if you wish?
>
> John
>
> John Weller
> 01380 723235
> 079763 93631
> Sent from my iPad
>
> > On 21 Aug 2019, at 05:22, MB Software Solutions, LLC <
> mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote:
> >
> > 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/cacuu1stxaaqxbkraf_vzmaou0gyaj9_dmk_tsdl1nxyjuv8...@mail.gmail.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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread John Weller
I use CDO to do just that. I’m not in the office until later today but when I 
get in I’ll send you some sample code if you wish?

John

John Weller
01380 723235
079763 93631
Sent from my iPad

> On 21 Aug 2019, at 05:22, MB Software Solutions, LLC 
>  wrote:
> 
> 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/9d2c6ca9-27b9-4156-9ca5-8e3cdabb5...@johnweller.co.uk
** 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.

Re: Easiest/best way to create an email using local MS Outlook with file attachments?

2019-08-21 Thread Kurt @ Gmail

Wow - Deja vu!

I joined this forum Circa 2008 - and, previously I was at a job and had 
to do Exactly this! It was maybe circa 2005-06. YEs, I did indeed do 
this via Office Automation. There was a great book out there - all about 
doing OA - and that's how I ended up doing the project. I too needed to 
do attachments as well.


Book w/all answers is by Hentzenwerks (probably misspelled that!). But, 
there you have it...


-K-

On 8/20/2019 9:22 PM, MB Software Solutions, LLC wrote:

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/f9d0f93d-a5d4-bf83-9bb9-1f8020a07...@gmail.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.