[OT] Using VBscript to send an email via outlook

Mike Bonner bonnmike at gmail.com
Sun Dec 16 14:25:29 EST 2012


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
>



More information about the use-livecode mailing list