Outlook 2010 - Sending A Daily Recurring Email Without Using A Custom Task

B

boricua2793

Good afternoon everybody -

I am hoping somebody out there may be able to help me with a problem that Iam having. I am trying to set up an email that gets sent to specific email addresses every day during the work week. I have looked around a bit online, and some pages reference the use of a custom task along with some VB script. While I am not a VB master, I am sure I could figure out how to tweak some existing code. My biggest problem is I want the email to be able to send itself automatically without any human intervention. If I am reading correctly, someone would still have to complete the task in order to trigger the email generation, I may be wrong but that is how it reads to me. Ido not want to have anyone pressing anything, just at 7:30 the email or draft sends every day. If need be I would be willing to use Access as a middle man, but I was hoping there would be a way to get this all set up in Outlook itself.

Any help that any of you Outlook/VB Jedi masters could provide would be greatly appreciated!

(Using Outlook Professional Plus 2010)

Erick
 
M

Michael Bednarek

I am hoping somebody out there may be able to help me with a problem that I am having. I am trying to set up an email that gets sent to specific email addresses every day during the work week. I have looked around a bit online, and some pages reference the use of a custom task along with some VB script. While I am not a VB master, I am sure I could figure out how to tweak some existing code. My biggest problem is I want the email to be able to send itself automatically without any human intervention. If I am reading correctly, someone would still have to complete the task in order to trigger the email generation, I may be wrong but that is how it reads to me. I do not want to have anyone pressing anything, just at 7:30 the email or draft sends every day. If need be I would be willing to use Access as a middle man, but I was hoping there would be a way to get this all set up in Outlook itself.

Any help that any of you Outlook/VB Jedi masters could provide would be greatly appreciated!

(Using Outlook Professional Plus 2010)

I suggest you create a VBS file to send the email; then use
the Windows task scheduler (not Outlook tasks) to have
CSCRIPT.EXE run that VBS file. It only needs Outlook to be
open, but no user interaction is required.

Here's the skeleton of such a VBS file:

Option Explicit

Dim appOutlook ' As Outlook.Application
Dim myMailItem ' As MailItem

Const olMailItem = 0
Const olFormatPlain = 1

' Is Outlook running?
Set appOutlook = Nothing
On Error Resume Next
Set appOutlook = GetObject(, "Outlook.Application")
Err.Clear
On Error Goto 0
If appOutlook Is Nothing Then
MsgBox "Outlook is not running. Nothing done.", vbOKOnly + vbExclamation, "boricua"
WScript.Quit
End If

' Send email
Set myMailItem = appOutlook.CreateItem(olMailItem)
With myMailItem
.Subject = "here goes the subject line"
.BodyFormat = olFormatPlain
.Body = "here goes the body of the email"
.Recipients.Add ("heregoes@therecipient")
.Recipients(1).Resolve
If .Recipients(1).Resolved Then
.Send
Else
MsgBox "Can't resolve " & "heregoes@therecipient" & ".", vbExclamation + vbOKOnly, "boricua"
End If
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top