Thread: Automate Email
View Single Post
  #2  
Old January 11th 07, 10:31 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Automate Email

wFor starters, you couldn't automate this from an external .exe or script
that starts Oultook and creates an e-mail message, as that's not supported.

The Outlook Object Model is unsuitable to run in a Windows service:
http://support.microsoft.com/default...b;en-us;237913

A server-side solution is best, but that involves creating an Exchange Event
Sink and is very advanced.

The best option is to create a recurring task and write VBA to trap the
Reminder event to check that it is your defined task, then run your code to
create and send an e-mail.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"A+P" wrote:

I'm running Outlook 2003 on Exchange 2003 server.
I would like to schedule an automated email that will be send out to the
same recipients with the same msg everyday from Mon-Fri in the morning. All
I have so far is the following code. How do I tell Outlook to do this
automatically every morning?
Attribute VB_Name = "Module1"

Option Explicit


Sub SendMail()


Dim olApp As Outlook.Application

Dim olMail As Outlook.MailItem

Dim blRunning As Boolean


'get application

blRunning = True

On Error Resume Next

Set olApp = GetObject(, "Outlook.Application")

If olApp Is Nothing Then

Set olApp = New Outlook.Application

blRunning = False

End If

On Error GoTo 0


Set olMail = olApp.CreateItem(olMailItem)

With olMail

'Specify the email subject

..Subject = "Pick up the Mail"

'Specify who it should be sent to

'Repeat this line to add further recipients

..Recipients.Add

..Body = "This is today's pick up mail reminder."

'Choose which of the following 2 lines to have commented out

..Display 'This will display the message for you to check and send yourself

'.Send ' This will send the message straight away

End With


If Not blRunning Then olApp.Quit


Set olApp = Nothing

Set olMail = Nothing


End Sub

Paul




Ads