Google
Search WWW Search msexchangetips.blogspot.com

Tuesday, August 01, 2006

Using Outlook Redemption to By Pass "A Program is trying to automatically send e-mail on your behalf"

Summary:

In Outlook SP2 and later versions, any application that tries to send e-mail is blocked to prevent the malicious propagation of viruses and worms. This article will provide a sample code using Outlook Redemption to bypass this security warning. This article will use Glen Scales "Message Tracking Logs Reports Script" as a sample in which mailbox reports is emailed using an Access Macro. First and foremost, I would like to thank and credit Glen Scales for this terrific script as it has come to be useful in my instances.

The first portion of this script is using Glen's Message Tracking Log Reports, which imports Exchange's Message Tracking logs into an Access Database. From here, I will use one of the custom Access queries included to email the report out while bypassing the "A Program is trying to automatically send e-mail on your behalf" warning message produced by Outlook.

Download Glen's Message Tracking Log Reports from:

http://www.outlookexchange.com/articles/glenscales/mtrackrs.asp

In this instance I have modified his script to only pull two user accounts from the message tracking log rather than the entire log file. Therefore I have edited this portion of the script:

size1 = objExchange_MessageTrackingEntry.size
If (RecipientAddress1 = "User1@mydomain.com") Or (RecipientAddress1 = "user2@mydomain.com") Then

wtowrite = "('" & condate(odate) & "','" & formatdatetime(odate,4) & "','" & ClientIP & "','" & EntryType & "','" & RecipientCount & "','" & replace(SenderAddress,"'","") & "','" & replace(RecipientAddress1,"'","") & "','" & left(replace(subject,"'"," "),254) & "','" & size1 & "')"
sqlstate1 = "INSERT INTO TrackingLogRaw ( [Date], [Time], [client-ip], [Event-ID], NoRecipients, [Sender-Address], [Recipient-Address], [Message-Subject], [total-bytes] ) values " & wtowrite
Cnxn1.Execute(sqlstate1)
End If
next
Next


Cnxn1.close

If you wish to pull all records use his orginal script in the link provided above.

1. Follow the instruction on Glen's site to implement the script.
2. Once you have implemented the script and is running,(verify that your trackinglograw has been populated) download Outlook Redemption.
http://www.dimastr.com/redemption/ Outlook Redemption provides extended objects to bypass the Outlook security warning.
3. Once you have installed Outlook Redemption, we will create a new module in Access. Click Module and select new. Paste the following code:

Option Compare Database

'------------------------------------------------------------
' Macro24
'
'------------------------------------------------------------
Function Command400_Click()
DoCmd.OutputTo acQuery, "Display-time-use", "HTML(*.html)", "C:\track" & Format(Date, "yymmdd") & ".html", False, "", 0
Set SafeItem = CreateObject("Redemption.SafeMailItem")
' create the Outlook session
Set objOutlook = CreateObject("Outlook.Application")
Set objNS = objOutlook.GetNamespace("MAPI")
objNS.Logon
' create the Message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
SafeItem.Item = objOutlookMsg
With SafeItem
.to = "emailadmin@mydomain.com"
.Subject = "track"
.Body = "trackbody"
.Attachments.Add "C:\track" & Format(Date, "yymmdd") & ".html"
.Importance = 2 'High =2 low = 1
'.Display
.Save
.Send
End With


Set objOutlookMsg = Nothing
Set objNS = Nothing
Set objOutlook = Nothing
Set SafeItem = Nothing



End Function

4. This module runs the "Display-time-use" query in Access and saves it to C:\Track directory while appending current date, then emails the this file as an HTML attachment to the recipint specified in the .to field. Click the save icon and close.
5. In Access, go to Macros and click new. In the action drop down, select run code. In the Function Name towards the bottom, enter Command400_Click() File Save as Macro1. This Macro calls the Module created in step 4, so that the Macro can be scheduled as a task. Modules cannot be schedule and thus requires a Macro.
6. Now you can schedule a batch file to call this Macro. Create a batch file and enter the following:

CD C:\Program Files\Microsoft Office\OFFICE11msaccess.exe c:\Trackinglog.mdb /x macro1
exit

7. Run this batch file to test.

James Chong (MVP)
MCITP | EMA; MCSE | M+, S+
Security+, Project+, ITIL
msexchangetips.blogspot.com


How useful was this article? Want to see a tip not listed? Please leave a comment.

10 Comments:

Blogger Alex said...

All in all for execute similar actions I advise to use-ldap outlook user password,because tool has no one capability and software is free as far as I can see,it recover password-protected files with *.pst extension for Microsoft Outlook email client,sorts all characters and constructs a fake password, which is always accepted by Microsoft Outlook email client,supports all versions of Microsoft Outlook, starting from Microsoft Outlook 97,program can work under all Windows operating systems from Windows 98. BTW, this one is not supported by Microsoft Corporation anymore, so, we recommend to upgrade,can recover passwords of Microsoft Outlook for a great number of services and mail accounts, such as Microsoft Mail, IMAP mail servers, POP3 mail servers, Microsoft Exchange Server, HTML mail servers and Microsoft LDAP Directory.

4:25 AM  
Blogger Alex said...

I worked with different program but once I had the big problem with mails.All of their were deleted from my MS Outlook.But me helped-export ost files,I found it in a big soft forum.Tool recover all mails for free.Besides I knew about next resource-it can export mail from .ost file supports all Windows platforms as well as Vista and all versions of Microsoft Office packages.

9:31 AM  
Blogger Alex said...

Today I was in net and downloaded a lot of tools.But after I opened my MS Outlook and understood that some of my mails were deleted.Fortunately myself helped one of those utilities-outlook message viewer.It decided problem in seconds and without payment.I was very lucky.

11:04 AM  
Anonymous email security service said...

Interesting blog. It would be great if you can provide more details about it. Thanks you

7:11 AM  
Blogger longge said...

The Hogan scarpe
brand is distinctive for high quality. Hogan scarpe donna
are the highest expression of a new luxury lifestyle. hogan donna
is meant for someone who cherishes the type of luxury associated. Apparently Ben had extra spikes put in his Hogan scarpe uomo
for extra grip.

6:01 PM  
Blogger longge said...

Now that replica handbags is selling all his goods at a high price, while the lower quality goods were rapidly available, we had to know that people were going to use this to trade in cash to this opportunity. LV is the most replicated designers, while some people say that it is the biggest compliment you could give someone. The replicas of sold louis vuitton handbags are really common in the USA; If you live in a large city you may notice it yourself. If you happen to notice a louis vuitton bags sold at a price which is cheap it is made from poor quality materials and are also sold for half the price a normal lv is sold for.

6:17 PM  
Blogger Alexis said...

For me exist some interesting softwares which I frequently use. Some days ago I dealt with by one funny software, which showed some interesting things. General idea was about that the tool could solve my old problem with outlook passwords. To my mind this program can refer with miscellanous problems quite good - outlook get password.

5:21 PM  
Anonymous www.webhablada.es said...

It will not succeed in actual fact, that is what I think.

6:37 AM  
Blogger meadow meadow said...

To see Cheap WOW Gold and Buy Runescape Goldworld in a granda of stand.And a heaven in a wild flower.Hold infinity in the palm your hand and eternity in an hour.

10:17 PM  
Blogger summerlijia said...

It doesn't matter who hurted you or broke you down. It matters who make you smile again.

-------------------------------------------------------------------------------------------
Diablo 3 gold, D3 gold

5:52 PM  

Post a Comment

<< Home

xml:lang="en" lang="en"> MS Exchange Tips: Using Outlook Redemption to By Pass "A Program is trying to automatically send e-mail on your behalf"