[OT] Using VBscript to send an email via outlook
Terry Judd
terry.judd at unimelb.edu.au
Sun Dec 16 18:14:57 EST 2012
Thanks Mike - I'll give that a go. I've got a VBS script that is working from Livecode (below) but it seems to lock things up occastionally.
Regards,
Terry...
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0)
With MyItem
.To = "a at b.c"
.Subject = "Test email from Livecode via Outlook"
.Body = "This is a test"
.DeferredDeliveryTime = "17/12/2012 10:15:00"
.Send
End With
On 17/12/2012, at 06:25 AM, Mike Bonner wrote:
> Try dumping the vbscript to a .vbs file and execute it with
> shell("myfile.vbs")
>
> In many cases it will just work. (probably send it to the temp folder so
> you don't have to worry about cleanup afterwards)
>
>
> On Sun, Dec 16, 2012 at 12:18 PM, Terry Judd <terry.judd at unimelb.edu.au>wrote:
>
>> Hi all - I want (if possible) to use a VBscript to format and send emails
>> from Livecode via Outlook on Windows ( I need to do it this way so that I
>> can take advantage of Outlook's DeferredDeliveryTime feature).
>>
>> Now, I know little or nothing about VBscript but the following routine
>> (courtesy of a Google search) runs fine as a macro within Excel. If however
>> I try to run it from Livecode (do [code] as "VBscript") it returns
>> 'execution error' in the result. Does anyone know enough VBscript to tell
>> me what I'm missing?
>>
>> Regards,
>>
>> Terry...
>>
>> Sub SendMail()
>> Dim OutApp As Object
>> Dim Outmail As Object
>> Dim strBody As String
>> Set OutApp = CreateObject("Outlook.Application")
>> OutApp.session.logon
>> Set Outmail = OutApp.CreateItem(0)
>> strBody = "This is a test"
>> On Error Resume Next
>> With Outmail
>> .To = "tsj at unimelb.edu.au<mailto:tsj at unimelb.edu.au>"
>> .CC = ""
>> .BCC = ""
>> .Subject = "Test email"
>> .Body = strBody
>> .DeferredDeliveryTime = "16/12/2012 16:00:00" 'dd/mm/yyyy hh:mm:ss'
>> .Send
>> End With
>> On Error GoTo 0
>> Set Outmail = Nothing
>> Set OutApp = Nothing
>> End Sub
>>
>>
>> Dr Terry Judd
>> Senior Lecturer in Medical Education
>> Medical Eduction Unit
>> Faculty of Medicine, Dentistry & Health Sciences
>> The University of Melbourne
>>
>>
>>
>> _______________________________________________
>> 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
>
Dr Terry Judd
Senior Lecturer in Medical Education
Medical Eduction Unit
Faculty of Medicine, Dentistry & Health Sciences
The University of Melbourne
More information about the use-livecode
mailing list