Solved

Automatically send a mail on a certain time using outlook  2003

Posted on 2008-10-23
5
1,260 Views
Last Modified: 2013-12-26
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
Comment
Question by:din101
  • 3
  • 2
5 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 22784508
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
 
LVL 3

Author Comment

by:din101
ID: 22784536
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
 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 500 total points
ID: 22787917
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
 
LVL 3

Author Closing Comment

by:din101
ID: 31509134
Thank you very much
0
 
LVL 76

Expert Comment

by:David Lee
ID: 22788718
You're welcome.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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