PDA

View Full Version : Disable security prompt when using "Item.Send" to forward emails



Conceptz
07-15-2011, 12:33 PM
Hi All,

I'm new to VBA programming so bare with me. I am trying to forward specific emails that arrive to my inbox. The email will be forwarded to specific email addresses based on the email subject title (user email is in the subject title). I have created a rule in my outlook, so when a new email is received in my inbox and matches certain criteria in the subject title, it will trigger my macro to run.

My macro (see code below) works, with one exception. It will give me the following security prompt:

A program is trying to automatically send e-mail on your behalf.
Do you want to allow this?
If this is unexpected, it may be a virus and you should choose "No".

It's a yes or no question, and the yes button is click-able after 5 seconds. Is there any way to disable this security prompt? I would hate to wait for 5 seconds, if there are multiple emails I have to forward.

My system environment details:
Windows XP SP3
Office 2003 SP3
No Admin Rights

Here's my code:
'Monitors incoming email based on a custom rule,
'when email comes from a specific address with a
'specfic subject title, macro will forward the
'email to email address listed in the subject title.

Sub FwdMailMacro(newMail As MailItem)

Dim objMail As Outlook.MailItem
Dim objFwd As Outlook.MailItem
Dim mailSubject As String
Dim userEmail As String

Set objMail = newMail
mailSubject = objMail.Subject
bStart = InStr(mailSubject, "(")
bEnd = InStr(mailSubject, ")")

'Parses the subject title from the original email
'for the recipients email address
userEmail = Mid(mailSubject, (bStart + 1), (bEnd - bStart - 1))

'creates the new email and forwards
Set objFwd = objMail.Forward
objFwd.To = userEmail
objFwd.Send
Set objFwd = Nothing
Set objMail = Nothing

End Sub

Any ideas or comments will be greatly appreciated. Thanks in advance!