blocking blank spam
I'm using Mail 1.3.11 (v622/624) and recently started getting spam with no to, from, subject or body text. I'm trying to work out how to set a rule to get rid of it but the rules require you to type a pattern to match before they are valid.
Anybody else come across this and have workaround?
Anybody else come across this and have workaround?
Comments
Originally posted by gardnerj
I'm using Mail 1.3.11 (v622/624) and recently started getting spam with no to, from, subject or body text. I'm trying to work out how to set a rule to get rid of it but the rules require you to type a pattern to match before they are valid.
Anybody else come across this and have workaround?
You are correct that the rules do not contain a "subject is blank", etc. -- I once tried to fix this by calling an AppleScript on each message, but that wasn't reliable either.
At present, I know of no way to reliably manage blank mail messages with an "incoming mail message" rule. HOWEVER, I think it can be done with a separate AppleScript that you would run on the Inbox every so often.
Would you like for me to take a shot at such a script? I think it would be pretty straightforward.
- Do you want these messages deleted, or moved to Junk?
- Do you want only messages that have *ALL* of the fields to, from, subject, and body empty to be identified, or is a message that has a blank body (but other fields present) also to be trashed?
tell application "Mail"
set oneWeekAgo to ((current date) - 7 * days)
set LF to ASCII character 10
set theMessages to (messages of inbox) whose date received is greater than oneWeekAgo
repeat with theMessage in theMessages
if content of theMessage is LF then delete theMessage
end repeat
end tell
Run that once a week or more often and it will zap messages which have a blank content area.
I have a version that is supposed to be triggered by a rule in Mail itself, but it is crashing Mail.app. I have a post on MacScripter to see if anyone else is crashing with it.
Here is the code that can be called by a Rule - set the Rule to "Run AppleScript" on "Every Message".
using terms from application "Mail"
on perform mail action with messages theMessages
repeat with theMessage in theMessages
if content of theMessage is (ASCII character 10) then
move theMessage to mailbox "Deleted Messages"
end if
end repeat
end perform mail action with messages
end using terms from
Edited at 10:18 PM EDT - finally removed all bugs.