Sending an Outlook E-Mail with voting options via a batch file

Is it possible to use a batch file to send an Email from Outlook 2007?  We need to make use of Outlook's Voting Buttons and cannot simply use an SMTP server to send the mail.  It must be sent through the Outlook application itself.  

Our goal is to have a watch on a drop folder which executes the batch file when a file is placed in the folder.  The batch file will parse the dropped file and send it off through Outook.  Is this possible with any of Outlooks command line switches or any other method?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, sellcenter.

It's possible with a bit of scripting.  Is that an option?
sellcenterAuthor Commented:
Yep, most definitely.  What did you have in mind?  Can you point me in the right direction?
David LeeCommented:
The script below will create and send a message.  You can incorporate the code into your script, if that's what you're using to monitor the folder and watch for the file, or call it from a batch file.
Dim olkApp, olkSes, olkMsg
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNamespace("MAPI")
'Change the profile name on the next line'
olkSes.Logon "Outlook"
Set olkMsg = olkApp.CreateItem(0)
With olkMsg
    'Change the subject text on the next line'
    .Subject = "Your Subject Goes Here"
    'Change the body text on the next line'
    .Body = "Your message goes here"
    'Change the path and file name of the attachment on the next line'
    .Attachments.Add "Some file name and path foes here"
    'Change the address on the next line'
    .Recipients.Add ""
End With
Set olkMsg = Nothing
Set olkSes = Nothing
Set olkApp = Nothing

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

sellcenterAuthor Commented:
Thanks.  I already have the code to send the email.

All I'm looking for now is a way for windows to run a batch file ( with command line arguments ) when a file is dropped into a directory.

Any ideas?
David LeeCommented:
Sorry, I guess I'm a little confused.  You asked, "Is this possible with any of Outlooks command line switches or any other method?"  I took that to mean that you already had a method of monitoring the folder and detecting when an item was added.  Outlook certainly can't monitor a file system folder for new files.  
This 3rd party software may work for you.  It watches a folder and then performs an action when it sees that a file has been added, updated, or deleted (you choose what to watch for).  Hope it helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alan HardistyCo-OwnerCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.