We help IT Professionals succeed at work.

Outlook script for auto reply

Stevrino
Stevrino asked
on
Medium Priority
1,736 Views
Last Modified: 2012-05-06
I am in need of scripting an auto reply for outlook 2003.
I need this to key on part of the subject line and also the domain of the sending email address.
I then want my reply to have the original subject line with some additional text which I would define.
I would also define the body of the email to be sent.

Example:
To: Original sender
From: me
Subject: Original Subject plus what I have defined in the script.

Body of the email which I have defined in the script.

I appricate any help offered.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2010

Commented:
Hi, Stevrino.

The two conditions can be handled by a rule.  I can post a script that'll do the rest.  There is an issue you need to be aware of though.  Sending a message via script is going to trigger Outlook's internal security.  The result will be a dialog-box popping up warnign you that an application is accessing your mailbox and asking for your permission to allow it to proceed.  That pretty much kills the process from being automatic.  There is no way to turn Outlook security off, but there are workarounds.  

1.  Write the code as an add-in.  Add-ins have different security constraints from macros.  Unfortunately, they are also more difficult to write.

2.  Sign the code with a digital signature.  A digital certificate is preferable, but you can "self-sign" code.  Here's a link to Microsoft instructions on how to do this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_dsvba.asp

3.  Use Click-Yes.  This is a free third-party utility that sits in your system tray and watches for the security warning dialog-box.  When one pops up it clicks the Yes button for you.  In my opinion it's dangerous though.  Here's a link to it: http://www.contextmagic.com/express-clickyes 

4.  Outlook Redemption.  This too is a third-party utility that allows you to circumvent Outlook security.  It isn't risk free, but I believe it's safer.  It's not free though and is meant more for developers than a casual user.  Here's a link to it: http://www.dimastr.com/redemption

Author

Commented:
Thanks BlueDevilFan.
I have a rule running already. The issue is it will only send 1 reply back to an address. I need it to send back to the same address if more than 1 email is sent, That is why I was thinking a script would be better. I do use Click-Yes now. I would also be interested in the "self-sign" you mentioned as well. I will look at it.
So you are saying use rules for the conditions and a script for the rest? Tell me more.
CERTIFIED EXPERT
Top Expert 2010
Commented:
By having the rule fire a script, via the "run a script" action, the script will send a response every time a message meeting the rule condtions arrives.  Of course this is a client-side rule, so it will only work when Outlook is running.  You can edit the subject and body as you see fit.
Sub Respond2Msg(Item As Outlook.MailItem)
    Dim olkMsg As Outlook.MailItem
    Set olkMsg = Item.Reply
    With olkMsg
        .Subject = Item.Subject & " My additional text goes here"
        .Body = "My body text"
        .Send
    End With
    Set olkMsg = Nothing
End Sub

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thanks BlueDevilFan, works like a charm.
CERTIFIED EXPERT
Top Expert 2010

Commented:
You're welcome.  Glad I could help.

Author

Commented:
BlueDevilFan,

If I want more than 1 body line how can I do that with particular breaks.
I see that HTML code will not work.
I can get more than 1 line but it is just 1 big long one that splits over the required lines.
CERTIFIED EXPERT
Top Expert 2010

Commented:
You can use HTML, we just need to change this line

    .Body = "My body text"

to

    .HTMLBody = "My body text<br>goes here"

Author

Commented:
Thanks again.
I did find that in the help section after I asked you the question. I appreciate all your help.
Is there a way to include the original mail in the reply...eg, so if someone emails me, I can reply with a message including their mail inside it?

Thanks

Pritesh
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.