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

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

Automatically send a mail on a certain time using outlook 2003

I need help on creating some sort of script to send mail out at 9 am every day to a email address.  Just on a weekday  

We use outlook 2003 with exchange 2003 and I can download visual basic  express I havent done any coding on VB so any help full answer will be appreciated
0
din101
Asked:
din101
  • 3
  • 2
2 Solutions
 
David LeeCommented:
Hi, din101.

Sending automatically is a problem since you're using Outlook 2003.  Microsoft added security features to Outlook preventing programs from sending messages automatically that weren't relaxed until Outlook 2007.  Those security features cannot be turned off, but they can be circumvented with 3rd-party tools.  Without sucha  tool it's impossible to send messages unattended.  Sending from code causes a dialog-box to pop up warning you that an application is trying to send and asking for your permission to allow it to continue.  You have to click a button for the message to send.  There are two tools for getting around this.  One is called Click-Yes (http://www.contextmagic.com/express-clickyes/).  It is a small utility that sits in the system tray and clicks the Yes button for you when the security dialog appears.  The other tool is Outlook Redemption (http://www.dimastr.com) a COM library that safely circumvents Outlook security in code.  You don't need a tool like VB to send messages.  You can do it with a simple bit of VBScript and schedule it to run using Windows Task Scheduler.  I can post the code if you want to do this.
0
 
din101Author Commented:
Yes please post the VB script.  Do I need to run both tools or just one of them ? I dont normally like to run many things on my computer but if I have to I dont mind.
0
 
David LeeCommented:
Ok, here's the code.  Follow these instructions to use it.

1.  Open Notepad
2.  Copy the code and paste it into Notepad
3.  Edit the code.  Look for the comment lines to see what needs to change
4.  Save the file with a .vbs extension
5.  Create a scheduled task and set it to run the script at what interval you need

The computer must be logged in using an account that has access to Outlook.  This version of the code will work with Click-Yes.  You can test it without Click-Yes, you'll just get Outlook's security dialog-box.
Const olMailItem = 0
Dim olkApp, olkSes, olkMsg
On Error Resume Next
Set olkApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If TypeName(olkApp) = "Nothing" Then
    Set olkApp = CreateObject("Outlook.Application")
    Set olkSes = olkApp.GetNamespace("MAPI")
    'Change the Outlook profile name on the next line as needed'
    olkSes.Logon "Outlook"
End If
Set olkMsg = olkApp.CreateItem(olMailItem)
With olkMsg
    'Change the address ont eh next line'
    .Recipients.Add "someone@company.com"
    .Recipients.ResolveAll
    'Change the subject on the next line'
    .Subject = "My Subject"
    'Change the message body on the next line'
    .Body = "Some text."
    .Send
End With
Set olkMsg = Nothing
Set olkSes = Nothing
Set olkApp = Nothing
WScript.Quit

Open in new window

0
 
din101Author Commented:
Thank you very much
0
 
David LeeCommented:
You're welcome.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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