This is the only rule i have enabled in mail.app. I want this to be applied to incoming email messages but it never gets run! However if i click on the email message and manually apply the rule it will do what i ask flawlessly. The rule is only supposed to run if the given email message was addressed from my email address. The reason why i have this is because whenever i send an email out, mail.app stores a copy in my “sent” folder. But whenever mail.app downloads the next batch of emails from gmail.com, it gets a duplicate copy of that email.
Rule: If any of the following conditions are met:
From Contains “myusername@gmail.com”
Perform the following actions:
Run Applescript “~/path/to/script.scpt”
using terms from application "Mail"
on perform mail action with messages message_list for rule this_rule
tell application "Mail"
set last_message to message 1 of mailbox "Sent Messages" of account "GMAIL"
set last_message_id to the message id of last_message
if message_list ≠{} then
repeat with received_message in message_list
try
set received_message_id to the message id of received_message
if received_message_id is equal to last_message_id then
delete received_message
else
move received_message to mailbox "Sent Messages" of account "GMAIL"
end if
end try
end repeat
end if
end tell
end perform mail action with messages
end using terms from
Since im working with multiple email clients, I dont always want to erase that duplicate email. The point is that the script works when i apply it to an email but doesnt get run automatically when i receive an email. Any ideas?
thanks
Model: powerbook g4
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)