John Colby
jwcolby at ColbyConsulting.com
Sat Feb 4 18:44:14 CST 2006
Well, I figured it out. The junk mail folder isn't under the inbox (on my machine anyway) and while it appeared to be returning a folder under the inbox in fact it wasn't valid or something. Once I changed my reference to get it from the right place it went without a hitch. For anyone interested BlueSecurity.com http://members.bluesecurity.com/cwa/users/welcome.do Is a company that works to put spammers in their place. I am a member and while I cannot say with any certainty that it helps, I am convinced that they are for real and recommend that anyone interested in helping to fight spam join. In order to make reporting my own spam easier, I created a macro inside of outlook to do the reporting. It is now "pushbutton". Pushbutton is good! In order to use this program, you need to create a macro in Outlook, create a toolbar with a button, and click the button. To create the code macro that will send the email: 1) From inside of outlook click Tools in the main menu 2) Click Macros / Visual Basic Editor. You will now be in the visual basic editor. 3) Click Insert / Module 4) Cut and paste the code below into the editor and save it. 4a) Set YOUR EMAIL ADDRESS with Blue Security in the very first line of the program in "MyUserName at reports.bluesecurity.com" 5) Click Save and close the editor To create a toolbar and a button to allow you to use the macro to send your spam to Blue Security: 6) Right click in the Outlook toolbar area at the top. 7) Click Customize / Toolbars / New. This will create a new toolbar. 8) Type in the name of your new toolbar - Blue Frog and click OK 9) You will now see a small blank toolbar. 10) In the "Customize" dialog click the "Commands" tab. 11) Click Macros. In the right hand pane of the dialog you should now see a macro named something like "project1.BlueFrogSecurityEmail" 12) Click-Hold-Drag and drop that macro onto your new toolbar 13) Close the "customize" dialog box 14) Drag the new toolbar up to the toolbars area of Outlook and dock it. To use the macro: All you need to do is make sure that your spam is in the Junk E-Mail folder in Outlook. If you use Spam Bayes or some other non-native junk mail processor it may have it's own folder that it places email in. If that is the case, you will need to drag and drop the junk mail from that folder into Outlook's "Junk E-Mail" folder. My macro only process email in that folder. If you have mail in the "Junk E-Mail" folder which is NOT JUNK, you need to get it out before you use the button because I delete all messages in the "Junk E-Mail" folder when I have finished sending the email. To send your junk email to Blue Security, set YOUR EMAIL ADDRESS with Blue Security in the very first line of the program. You have to be set up and have an account with Blue Security in order to have such an email address, ad if you are, you should know what your email address is with them. To actually send email, just click the button in your new toolbar. Any email in the "Junk E-Mail" folder in Outlook will be attached to an email and sent to Blue Security. All email in that folder will then be deleted. CHECK THE FOLDER FIRST to make sure that no letters from mom, your bank, etc are sitting in the junk mail folder. '*************************************************** 'THIS IS THE CODE: '*************************************************** Const cstrBlueSecurityEmailAddress As String = "MyUserName at reports.bluesecurity.com" Sub BlueFrogSecurityEmail() SendBlueSecurityEmail cstrBlueSecurityEmailAddress End Sub Function SendBlueSecurityEmail(strRecipient As String, Optional ProfileName) On Error GoTo Err_SendBlueSecurityEmail Dim myOlApp As Outlook.Application Dim myOLItem As Object Dim fldrJunk As Outlook.MAPIFolder Dim msg As Outlook.MailItem Set myOlApp = OpenOL(ProfileName) Set fldrJunk = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderJunk) If (fldrJunk.Items.Count > 0) Then Set myOLItem = myOlApp.CreateItem(olMailItem) With myOLItem .To = strRecipient For Each msg In fldrJunk.Items Debug.Print "SendBlueSecurityEmail - Processing message: " & msg .Attachments.Add msg Next msg End With myOLItem.Send ' 'Delete the items from the spam folder ' While fldrJunk.Items.Count > 0 fldrJunk.Items.Remove (1) Wend End If Exit_SendBlueSecurityEmail: Exit Function Err_SendBlueSecurityEmail: Select Case Err Case 0 '.insert Errors you wish to ignore here Resume Next Case Else '.All other errors will trap Beep MsgBox Err.Description, , "Error in Function dclsOutlook.SendBlueSecurityEmail" Resume Exit_SendBlueSecurityEmail End Select Resume 0 '.FOR TROUBLESHOOTING End Function Private Function OpenOL(Optional ProfileName) As Outlook.Application On Error GoTo Err_OpenOL Dim objOL As Outlook.Application On Error Resume Next Set objOL = GetObject(, "Outlook.Application") If objOL Is Nothing Then Set objOL = CreateObject("Outlook.Application") objOL.Session.Logon ProfileName, , False, True End If Set OpenOL = objOL Set objOL = Nothing Exit_OpenOL: Exit Function Err_OpenOL: Select Case Err Case 0 '.insert Errors you wish to ignore here Resume Next Case Else '.All other errors will trap Beep MsgBox Err.Description, , "Error in Function dclsOutlook.OpenOL" Resume Exit_OpenOL End Select Resume 0 '.FOR TROUBLESHOOTING End Function John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Colby Sent: Saturday, February 04, 2006 11:17 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] OT: Coding to Outlook Does anyone out there code in outlook directly? I use BlueSecurity.com http://members.bluesecurity.com/cwa/users/welcome.do To report my spam. Just a personal "feels good to do this" thing. It requires sending an email to BlueSecurity when I get enough in the spam box to make it worthwhile. It would be nice to have a button on my Outlook bar that opens an email to BlueSecurity, attaches the spam emails to the opened email, sends the email, then deletes the emails in the spam folder. It only takes me about 1 minute to do this manually but doing it daily gets old after awhile. Spam filtering is so good now that I probably have less than 1 in 50 things that hit the spam folder that should not be there. By keeping the spam folder cleaned out daily it makes it easier to ensure that any non-spam items get removed from the spam folder before I report the spam. I have tried writing the code myself but for some reason the code is telling me that there are no emails in the spam folder when I can see that there are. John W. Colby www.ColbyConsulting.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com