Skip navigation.
 
mlRe: Notification when new email received
FROM : has
DATE : Mon Nov 19 12:39:01 2007

Steve Cronin wrote:

> I've checked around and I don't see any formal means to be notified
> when a new piece of email is received.
> Yes, I do realize the general problem of the many different mail
> clients but my interest is (for now) in Mail.app.
>
> Given that, what would be the general counsel for best way to keep up-
> to-date with new mail?
>
> I have the AppleScript to get unread counts from any desired
> mailbox,  I'm thinking I should just run this AppleScript using 
> NSTimer.



Polling the unread count would be unreliable; e.g. users may get and 
read new mails between polls.

AKAIF, the only formal notification mechanism in Mail is its rules 
system. e.g. You could set up a Mail rule that runs an AppleScript 
when new messages arrive (rule creation can be scripted if you want to 
set this up automatically). That script could then send an Apple event 
to your application informing it that new mail has arrived, along with 
any information about the received messages that your application 
might need.

Depending on your requirements it might be possible for some other 
email clients to invoke the same API, which will simplify adding 
support for those.

You'd need to say more about what your app does and how it needs to 
interact with email clients to give more specific suggestions.

You might also file a feature request on Mail, asking that it send a 
distributed notification when new mail arrives.

HTH

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org

Related mailsAuthorDate
mlNotification when new email received Steve Cronin Nov 18, 20:42
mlRe: Notification when new email received has Nov 19, 12:39
mlRe: Notification when new email received Steve Cronin Nov 19, 16:04