Vbscript sends e-mail via Vista/Outlook 2007, but mail stays inOutbox until Outlook is opened manual

L

leom

I have written a vbscript file to send an e-mail. When the script is
executed, Outlook is not running. The script works fine on a machine
running Windows XP and Outlook 2003. When I run the script on a Vista
machine with Outlook 2007, the mail stays in the outbox until Outlook
is opened manually.

The relevant parts of the script for Vista and Outlook 2007 are:

Set objOutl = CreateObject("Outlook.Application")

Set objMailItem = objOutl.CreateItem(olMailItem)



strEmailAddr = StudentEmailAddress

objMailItem.To = strEmailAddr

objMailItem.Subject = " Student Class Files from " &
DATE

objMailItem.Body = "The attached file is from your " &
DATE & " seminar."

objMailItem.Attachments.Add CurrentFile

objMailItem.Send



Set objMailItem = nothing

Set objOutl = nothing



I have tried adjusting the Send/Receive settings in Outlook,
particularly the Perform an Automatic Send/Receive when Exiting
setting. This did not help.
 
K

Ken Slovak

For 2007 you will need to display an Explorer. Get a folder like Inbox and
use the GetExplorer() method, then display it. That will let the items send.
 

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