Solved

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

Posted on 2004-10-04
4
344 Views
Last Modified: 2008-02-01
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
Comment
Question by:scottman29
  • 2
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
You can run your script as a scheduled task in Windows.

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

Hope it helps!
0
 
LVL 5

Author Comment

by:scottman29
Comment Utility
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
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
Comment Utility
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
 
LVL 5

Author Comment

by:scottman29
Comment Utility
looks like what I want, thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Controlling which port to download from 4 57
DIR issue 7 46
Excel object stays open 19 65
VBA saving file message display 5 47
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now