sending email and file with mail client
Terry Judd
terry.judd at unimelb.edu.au
Mon Feb 18 23:22:59 EST 2019
No worries Tom - glad it was helpful.
Terry...
Sent from my iPhone
> On 19 Feb 2019, at 2:58 pm, Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Terry, I learned so much from your answer, thanks for taking the time.
>
> On Mon, Feb 18, 2019 at 5:38 PM Terry Judd via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> Hi Hershel - If it's a desktop app then you can control the user's email
>> app using either applescript (MacOS) or VBscript (Windows). I've included
>> some template scripts below to get you started (assuming your users have
>> either Mail or Outlook). I store these in custom properties, use merge to
>> replace the quoted variables and the do as applescript or vbscript
>> depending on what platform you are targeting.
>>
>> Couple of gotchas to do with line breaks in 'theBody' text...
>> Pretty sure that Apple Mail doesn't know what to do with html (at least
>> not using the script below)
>> Outlook expects html formatted text so if you're passing plain text you'll
>> need to replace CR with '<br>'
>> If you are using VBscript then you need to do something like...
>>
>> put quote before theBody
>> replace CR with (quote&" & VbCrLf & _" & return & quote) in theBody
>> put quote after theBody
>>
>> Hope that helps,
>>
>> Terry...
>>
>>
>> Mail app (MacOS):
>>
>> tell application "Mail"
>> activate
>> set messageSubject to "[[theSubject]]"
>> set messageBody to "[[theBody]]"
>> set recipientName to "[[theRecipientName]]"
>> set recipientAddress to "[[theRecipientAddress]]"
>> set attachmentPath to "[[theFileName]]"
>> set theMessage to make new outgoing message with properties
>> {visible:true, subject:messageSubject, content:messageBody}
>> tell theMessage
>> make new to recipient with properties {name:recipientName,
>> address:recipientAddress}
>> make new attachment at the end of theMessage with
>> properties {file name:attachmentPath}
>> end tell
>> delay 1
>> send theMessage
>> end tell
>>
>> Outlook app (MacOS):
>>
>> tell application "Microsoft Outlook"
>> activate
>> set messageSubject to "[[theSubject]]"
>> set messageBody to "[[theBody]]"
>> set recipientName to "[[theRecipientName]]"
>> set recipientAddress to "[[theRecipientAddress]]"
>> set attachmentPath to "[[theFileName]]"
>> set theMessage to make new outgoing message with properties
>> {subject:messageSubject, content:messageBody}
>> make new recipient at theMessage with properties {email
>> address:{name:recipientName, address:recipientAddress}}
>> make new attachment at the end of theMessage with properties
>> {file:attachmentPath}
>> send theMessage
>> end tell
>>
>> Outlook app (Windows):
>>
>> Set MyApp = CreateObject("Outlook.Application")
>> Set MyItem = MyApp.CreateItem(0)
>> With MyItem
>> .To = "[[theRecipientAddress]]"
>> .Subject = "[[theSubject]]"
>> .Body = [[theBody]]
>> .Attachments.Add("[[theFileName]]")
>> .Send
>> End With
>>
>> On 19/2/19, 8:00 am, "use-livecode on behalf of Hershel F via
>> use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of
>> use-livecode at lists.runrev.com> wrote:
>>
>> Hi every one, wondering how i can send an email with an attachment
>> (invoice) direct from my app with user’s email client (mail)?
>> using the revMail only give the possibility for contents of fields,
>> any work arounds or printing into a fld then putting the fld into the email?
>>
>> Thanks in advanced. HershelF
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list