Solved

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

Posted on 2004-10-04
4
368 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 12218429
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
ID: 12218465
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
ID: 12218717
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
ID: 12239364
looks like what I want, thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month3 days, 21 hours left to enroll

630 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