Script an email to send on a daily basis from outlook 2003
Posted on 2004-10-04
I've read through the posts on this from various other areas of EE, and I still have a few questions. Here is what I am trying to do:
I have a file that is created on my C drive at 5:30 AM everyday. I need to email this file as an attachement on a daily basis to 2 recipients. I would like to schedule the email to be sent at 6:30 AM.
I built a macro in Outlook that does what I need to do, see below, however, I don't know how to schedule it to run, and then I don't know how to get around the outlook security warning that comes up about being sent on my behalf. I did install "click yes", but, if my machine is locked, as it usually is at 6:30 AM, you know that click yes will not work.
I was hoping to use WSH, so that this may not be outlook dependant, I did find vbsendmail, but it's a bit beyond what I know how to do in VB.
Here's my code:
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
.To = "firstname.lastname@example.org"
.Subject = "test"
.Body = "hi guys"
.Attachments.Add "c:\scanxfer.txt", olByValue
Set objOutlook = Nothing