I want to set up an automated email, that will send me an email every night at around 1am, with a log file attachment which it pulls from a specified data source on said machine. Any ideas how I can set this up on outlook 2007?
I've looked into scripting but not too keen on it. Any and all help appreciated.
Problem solved by scripting...
set a script for the outlook to start running the vbs, then set a script for the outlook to close after an hour.Code:Const SOURCE_FOLDER As String = "C:\temp\" Const RECIP_A As String = "email@example.com" Const RECIP_B As String = "firstname.lastname@example.org" Const RECIP_C As String = "email@example.com" Const SUBJECT As String = "ABC001 Logs" Const EMAIL_BODY As String = "Please find attached file. Thanks and Regards, ABC" Sub Sendlogs() On Error GoTo ErrorHandler Dim fileName As String fileName = Dir(SOURCE_FOLDER) Do While Len(fileName) > 0 Call CreateEmail(SOURCE_FOLDER & fileName) fileName = Dir Loop ProgramExit: Exit Sub ErrorHandler: MsgBox Err.Number & " - " & Err.Description Resume ProgramExit End Sub Function CreateEmail(fileName As String) Dim olApp As Outlook.Application Dim msg As Outlook.MailItem ' create email Set olApp = Outlook.Application Set msg = olApp.CreateItem(olMailItem) ' set properties With msg .SUBJECT = SUBJECT .Body = EMAIL_BODY .Recipients.Add (RECIP_A) .Recipients.Add (RECIP_B) .Recipients.Add (RECIP_C) .Attachments.Add fileName .Send End With End Function
There are currently 1 users browsing this thread. (0 members and 1 guests)