|
|
#1 |
|
Prospect
Join Date: Oct 2003
Posts: 23
|
Using Automator to report spam?
Is it possible to use Automator to report spam to spam@mac.com? Right now, for each email, here's what I have to do by hand:
- press Command-Option-U to show all the headers for a message - press Command-A to select the entire message text - click the Forward button - type 'spam@mac.com' in the To: field - click the Send button - press Delete to delete the original message Is there a way to automate these steps with Automator (or in any other way), so that I can select an email message and click one button and have the spam reported and deleted? |
|
|
|
|
|
#2 |
|
MVP
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
|
save this in the Mail applescript menu. ( Or use it in Automator ) select the single mail. and run it.
I only did this for single mail selection but it can be changed for multi. Code:
tell application "Mail"
set selectionMessage to selection
set theMessages to item 1 of selectionMessage
set the_headers to all headers of theMessages as string
set the_content to content of theMessages
set theBody to the_headers & return & return & the_content
end tell
set theSubject to "this is spam"
set theAddress to "spam@mac.com"
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to true
make new to recipient at end of to recipients with properties {address:theAddress}
send
end tell
end tell
|
|
|
|
|
|
#3 |
|
Prospect
Join Date: Oct 2003
Posts: 23
|
Thank you so much for posting this! I'm going to give it a try!
I don't know AppleScript - is it simple to modify so that I can select a bunch of messages and have them all reported one-by-one with just a single run of the script? |
|
|
|
|
|
#4 |
|
MVP
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
|
I will have a look when I get home in a bit..
|
|
|
|
|
|
#5 |
|
MVP
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
|
This should do it. Take not of the comments inside, there is an option
to choose which sending account you use. Code:
tell application "Mail"
set selectionMessage to selection
set counter to 0
set mail_number to count messages in selectionMessage
repeat with theMessages in selectionMessage
set counter to counter + 1
set theMessages to item counter of selectionMessage
set the_headers to all headers of theMessages as string
set the_content to content of theMessages
set theBody to the_headers & return & return & the_content
set theSubject to "This is spam"
set theAddress to "spam@mac.com"
(*
Remove every thing between the (* and *) apart from line -> set theSender to "youmailaddreshere@mac.com" <-
Put you prefered account email address to send from in the address below.
Also look further down and remove the -- from the line -> set sender to theSender <-
set theSender to "youmailaddreshere@mac.com"
*)
set the SenderAccount to ""
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to false
--set sender to theSender
make new to recipient at end of to recipients with properties {address:theAddress}
send
end tell
end tell
end repeat
end tell
|
|
|
|
|
|
#6 |
|
Prospect
Join Date: Oct 2003
Posts: 23
|
That's awesome! Works great! Thank you so much! :-D
|
|
|
|
|
|
#7 |
|
Prospect
Join Date: Oct 2002
Posts: 4
|
Thank you SOOOO much!!
Mark,
thank you SOO much for writing this script, as well as to the original poster for asking for the EXACT thing I was looking for. i'm very new to applescript and was trying to give this a go myself for about 3 hours last night and didn't really come close I was trying to use the "forward" command and wasn't getting anywhere, and I still hadn't really figured out how to show the full headers since the default forward does not include the full headers. I added a "delete selectionMessage" command just before the penultimate "end tell" ... eg: make new .... send end tell delete selectionMessage end tell end repeat end tell this deletes the spam so i get to spend even less time with that crap! thanks! Bhavesh Patel Last edited by veshman; 12-06-2005 at 06:39 PM. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|