Solved

Automatically send a mail on a certain time using outlook  2003

Posted on 2008-10-23
5
1,254 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
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…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

743 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

12 Experts available now in Live!

Get 1:1 Help Now