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

  • Thread starter Thread starter leom
  • Start date Start date
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.
 
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.
 
Back
Top