Notification when new email received

  • Folks;

    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.

    Am I missing something better in Cocoa?  (This is Tiger BTW  -
    Leopard only leaves too many customers out in the cold for now...)

    Is there a better design approach?

    Thank-you for any thoughts on this matter!
    Steve
  • 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
  • Has;

    I had not realized that Mail rules could be created by scripts!
    This overcomes my hesitation with what I had thought to be the best
    solution:  have Mail tell me when mail arrives!
    I did not want to make a customer have to create a mail rule - many
    folks would rather stab themselves with a rusty fork.
    Based on your response I've already got a rule created by script that
    will ping me with only the exact messages I'm interested in! YES!
    Even better for my purposes than a generalized distributed
    notification (which could get pretty noisy!)

    This will drive me to add a modicum of scriptability to my app, which
    as you point out, will allow me to reuse this mechanism for other
    mail clients down the road...

    Thanks a TON!
    Steve

    On Nov 19, 2007, at 5:39 AM, has wrote:

    > 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
    >
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today