GrowlMail Suggestion

The Growl forums have moved to Google Groups, this forum is read only.
sodapop
Harmless
Posts: 2
Joined: Mon Aug 18, 2008 6:29 pm

GrowlMail Suggestion

Postby sodapop » Mon Aug 18, 2008 6:58 pm

It would be better to assign a growl notification with/to a Rule rather than to activity in an email box. I don't need notification for each and every email.

User avatar
The_Tick
Cocoaforge Admin
Posts: 4642
Joined: Thu Dec 02, 2004 6:06 am
Contact:

Re: GrowlMail Suggestion

Postby The_Tick » Tue Aug 19, 2008 9:55 pm

We used to ship scripts that did this. Nobody maintained them, so we dropped all scripts. You can find them in older releases, we just won't support them.

User avatar
Diggory
Growl Team
Posts: 129
Joined: Sat Dec 04, 2004 12:17 pm
Location: London

Re: GrowlMail Suggestion

Postby Diggory » Wed Aug 20, 2008 12:43 am

Here's the script I use:

Code: Select all

to getPictureForEmailAddress(personEmailAddress)
   tell application "Address Book"
      try
         set thePerson to (first person where the value of emails contains personEmailAddress)
         set thePiccy to image of thePerson
         return thePiccy
      end try
   end tell
end getPictureForEmailAddress



using terms from application "Mail"
   on perform mail action with messages theMessages for rule theRule
      --    display dialog ("Got here.  ")
      tell application "Mail"
         repeat with thisMessage in theMessages
            try
               -- If this is not being executed as a rule action,
               -- getting the name of theRule variable will fail.
               set theRuleName to name of theRule
               
               set theSubject to subject of thisMessage
               set theSender to sender of thisMessage
               set theJunkStatus to junk mail status of thisMessage
               set theReadStatus to read status of thisMessage
               
               --   We don't need to be notified of Junk
               if (theJunkStatus is true) then
                  log ("junk")
                  return
               end if
               
               --   Extract the email address and display name of the sender
               set theSendersName to extract name from sender of thisMessage
               set theSendersAddress to extract address from sender of thisMessage
               --   Find the sender's piccy
               set thePersonsPicture to my getPictureForEmailAddress(theSendersAddress)
               
               -- Check for spam not caught by Mail - but caught by Mail Provider's Anti-Spam.
               --   Your provider's warning string maybe different.
               if ((theJunkStatus is not true) and (theSubject does not contain "[**SPAM**]")) then
                  if (theReadStatus is false) then
                     tell application "GrowlHelperApp"
                        set myAllNotesList to {"Mail Received"}
                        register as application "Mail Notification Script" all notifications myAllNotesList default notifications myAllNotesList icon of application "Mail.app"
                        try
                           notify with name "Mail Received" title theSendersName description theSubject application name "Mail Notification Script" image thePersonsPicture
                        on error the errorMessage -- user without picture in adressbook
                           notify with name "Mail Received" title theSendersName description theSubject application name "Mail Notification Script" icon of application "mail.app"
                        end try
                     end tell
                  end if
               end if
            end try
         end repeat
      end tell
   end perform mail action with messages
end using terms from


Return to “Growl”

Who is online

Users browsing this forum: No registered users