VBA Script to Forward Spam to AntiSpam Provider Using "Blank" Form

Status
Not open for further replies.

Arimis

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Our anti-spam provider wants all false-negatives forwarded such that they can be run through their heuristic and linguistic algorithms to improve their capture rate. I was able to cobble together a script (works) and create a toolbar click (works) from various snippets of code. The problem is that the forward contains the default signature for forwards / replies (which they don't want to see). I've beaten my head against the wall trying to have the script to use a custom form (without a signature) to no avail. The signature is always there. Here's a copy of the script I'm using.




Sub SPAM()


Dim objMail As Outlook.MailItem


Set objItem = GetCurrentItem()


Set objMail = objItem.Forward


objMail.To = "spam@mx25.net"


objMail.Display


Set objItem = Nothing


Set objMail = Nothing


End Sub




Function GetCurrentItem() As Object


Dim objApp As Outlook.Application


Set objApp = Application


On Error Resume Next


Select Case TypeName(objApp.ActiveWindow)


Case "Explorer"


Set GetCurrentItem = _


objApp.ActiveExplorer.Selection.Item(1)


Case "Inspector"


Set GetCurrentItem = _


objApp.ActiveInspector.CurrentItem


Case Else


End Select


End Function




Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)




End Sub






If someone could advise as how to either use a "blank" form for the submission or how to strip the signature, that would be blessing.




Thank you.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Not tested... but try objMail.body =""

then objMail.body = objitem.body

Or something like that. It you need to senders, address or date, you can create a header block :

Dim strHeader As String
strHeader = "------------------" & objItem.SenderName & vbCrLf & objItem.SenderEmailAddress & vbCrLf & vbCrLf
objMail.Body = strHeader & objItem.Body

Do they only need the body or also the message header?
 

Arimis

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Greetings All (and especially Diane Poremsky)




If your anti-spam provider would like exemplars of false-negatives and you want to automate the process at much as possible, the following script works flawlessly in an Outlook 2007 environment. It grabs the focused false-positive and just sends it off to the eval algorithms of your anti-spam provider. The only thing you have to change is the objMail.To reference. Here's the script.




Sub SPAM()


Dim objMail As Outlook.MailItem


Set objitem = GetCurrentItem()


Set objMail = objitem.Forward




objMail.Body = ""


objMail.Body = objitem.Body


objMail.To = "your anti-spam provider"


objMail.Display


Set objitem = Nothing


Set objMail = Nothing


End Sub




Function GetCurrentItem() As Object


Dim objApp As Outlook.Application


Set objApp = Application


On Error Resume Next


Select Case TypeName(objApp.ActiveWindow)


Case "Explorer"


Set GetCurrentItem = _


objApp.ActiveExplorer.Selection.Item(1)


Case "Inspector"


Set GetCurrentItem = _


objApp.ActiveInspector.CurrentItem


Case Else


End Select


End Function






Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)




End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D.Moore VBA script fail after Office 365 update Using Outlook 8
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
dweller Outlook 2010 Rule Ignores VBA Script Outlook VBA and Custom Forms 2
N VBA Script to Open highlighted e-mail and Edit Message Outlook VBA and Custom Forms 5
K Outlook Archive to PST Files by Date Range VBA Script? Outlook VBA and Custom Forms 1
Peter H Williams Enable script containing VBA Outlook VBA and Custom Forms 12
R VBA Script Quick Parts Using Outlook 1
Q VBA Script to move item in secondary mailbox Outlook VBA and Custom Forms 2
N VBA Script to Send Automatic Emails from Outlook 2010 Outlook VBA and Custom Forms 1
O modify vba to run it as script rule Outlook VBA and Custom Forms 8
P How many subs can run in one outlook VBA script Using Outlook 5
J Email Parsing VBA Script for Outlook - NEEDED Outlook VBA and Custom Forms 7
P Vba script including macro appears in rules but wont run Outlook VBA and Custom Forms 6
R Adding vba to script list Outlook VBA and Custom Forms 4
F VBA script to highlight specific words Outlook VBA and Custom Forms 1
D VBA Script to extract text matching specific criteria Outlook VBA and Custom Forms 1
D VBA Script (Ask to where to save send mail) Outlook VBA and Custom Forms 1
M VBA script to allow mail merges of distribution groups? Using Outlook 7
D VBA script to auto download attachments and rename file according to subject line Outlook VBA and Custom Forms 23
Hudas Outlook VBA script reverting back to previous changes Outlook VBA and Custom Forms 2
J Outlook 2007 Rules & VBA: How to run a script on a report message (ReportItem) Using Outlook 14
V "Accept + Send the Response now", VBA script? Using Outlook 1
R Addins4Outlook TagIt! addin script or VBA module? Using Outlook 2
S Outlook VBA rule script to process both MailItem and MeetingItem Using Outlook 0
L Limit VBA Script to one Outlook account Using Outlook 1
S Add VBA save code Using Outlook 0
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1
O VBA Cases with Listbox - Can you use Multi-Select? Outlook VBA and Custom Forms 4
O VBA Outlook Message Attachment - Array Index Out of Bounds Outlook VBA and Custom Forms 0
V Modifying the built in forms with VBA Outlook VBA and Custom Forms 4
S Excel VBA and shared calendar issue Outlook VBA and Custom Forms 4
L Macro/VBA to Reply All, with the original attachments Outlook VBA and Custom Forms 2
L VBA unknown character Outlook VBA and Custom Forms 2
G Move tasks up/down todo list by VBA Outlook VBA and Custom Forms 1
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
J Want to learn VBA Macros for Outlook. What book can you recommend? Outlook VBA and Custom Forms 2
F VBA code to dock Styles whenever I write or edit an email Outlook VBA and Custom Forms 0
C VBA to prompt for Sent folder destination Outlook VBA and Custom Forms 3
B Adding signature to bottom of VBA reply email Outlook VBA and Custom Forms 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
R Limiting length of saved attachment in VBA Outlook VBA and Custom Forms 2
S Skype for business meeting vba code Outlook VBA and Custom Forms 1
C How to use VBA to show only items x days old or more Outlook VBA and Custom Forms 1
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
S Reference Custom Fields with VBA Outlook VBA and Custom Forms 2
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1

Similar threads

Top