Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

Script an email to send on a daily basis from outlook 2003

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.

Thanks,
Scott
Here's my code:

Sub scanxfer()
Dim objOutlook
Dim objEmail

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
    .To = "swarm@gwn.com"
    .Subject = "test"
    .Body = "hi guys"
    .Attachments.Add "c:\scanxfer.txt", olByValue
    .Send
End With

Set objOutlook = Nothing

End Sub
0
scottman29
Asked:
scottman29
  • 2
  • 2
1 Solution
 
Erick37Commented:
You can run your script as a scheduled task in Windows.

Control Panel->Scheduled Tasks->File->New...

Hope it helps!
0
 
scottman29Author Commented:
do you mean put that script in a .bat file and then schedule it?  will it get around the outlook security that way as well?
0
 
Erick37Commented:
Here is an article from MS using CDO to send mail via a remote SMTP server:

How To Send HTML Formatted Mail Using CDO for Windows 2000 and a Remote SMTP Service
http://support.microsoft.com/default.aspx?scid=kb;en-us;286431

The script is saved as a VBScript (vbs) file.
0
 
scottman29Author Commented:
looks like what I want, thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now