Ok, I have been playing around a bit with this.

I added the listener through the Spring XML files and now I receive
the events in my listener. It's working great.

When event.getSession().getType().equals(SessionType.System), the
e-mail is being handled/received/modified through SMTP, right?
Otherwise it's user, which is the user doing some actions himself, right?

So this way I could check if a user is dragging an e-mail inside his
INBOX, or it's a message received by SMTP.

Because when a user is dragging an e-mail inside his INBOX, I need to
sync this back to our CRM, so I can make the message there, too.

Also, I was wondering what would be the best way to query the mailbox.
For example, when I receive a message in the listener, could I use the
event.getSession().getAttributes().get("MESSAGEMAPPER") safely? It's
mentioned this class isn't thread safe. But I need to be able to fetch
the full message including headers and everything, so I can sync it to
our CRM.

Also, I was wondering what would be the best way to do the status
updates from our CRM. Because when I make an IMAP session and mark a
message read, the listener receives it and syncs it back to our CRM.
That way I'm doing double syncing, which isn't what we want of course.

Could I check for example the host name inside the public void
event(Event event)? I cannot seem to find any methods or properties
that would give me a context containing these details.

I also saw a createSystemSession()-method on the MailboxManager. I'm
not sure how to access this MailboxManager though. I could register it
to some class using the spring beans (or even my listener class), but
I don't think that would be a good idea. I could set up something
using JMS messaging so a class inside JAMES would be receiving
messages through JMS and then update the mailbox. Though I think there
must be a better way, but I cannot seem to find it yet.

I hope you guys could give me a bit more insight on how to do this.
Not asking for complete solutions. :) I just don't know where to look
yet. :)

Thanks for the help so far, much appreciated.

On Thu, Jan 26, 2012 at 4:56 PM, Norman Maurer
<norman.mau...@googlemail.com> wrote:
> Hi there,
>
> you can register a MailboxListener in the MailboxManager instance and
> so get notifications about mailbox events. This should do the job.
>
> Have a look here:
>
> http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MailboxManager.java?view=markup
> http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MailboxListenerSupport.java?view=markup
> http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MailboxListener.java?view=markup
>
> Let me know if you need more info..
>
> Bye,
> Norman
>
>
> 2012/1/26 l0c4l h0st <l0c4lh0st.d...@gmail.com>:
>> Hello,
>>
>> What I'm trying to do is capture events that the IMAP-server should
>> (or is supposed to) raise.
>>
>> Whenever a message gets marked as read, I want to get a notification
>> of this event.
>> Whenever a message gets marked as unread, I want to get a notification
>> of this event.
>> Whenever a message gets flagged, I want to get a notification of this event.
>> Etc. etc.
>>
>> Whenever a user moves a message to a different IMAP folder, I want to
>> get a notification of this event.
>> Whenever a user deletes a message to a different IMAP folder, I want
>> to get a notification of this event.
>> Whenever a user copies a message to a different IMAP folder, I want to
>> get a notification of this event.
>>
>> Right now, I don't see any way of doing this. I thought this would be
>> possible with the Matchers and Mailets, but I don't see how this would
>> be possible.
>>
>> I can define a custom mailet, that matches on ALL, when I add this
>> mailet in the root- and transport-processors, I get notifications only
>> of mail that arrives through SMTP and mail that is sent through SMTP.
>>
>> Am I missing the IMAP way of doing this? Or is there currently no way
>> of doing this with IMAP?
>>
>> I've tried searching through the code, but I don't see any event
>> listeners or anything that would be triggered. I did find
>> ImapStateAwareMailboxListener, but I cannot find how to subscribe to
>> this event or anything.
>>
>> Also, I found the UpdatedFlags class, but there is no notification
>> sent anywhere.
>>
>> SO:
>> How can I get a notification of every single change that is made to a
>> message in IMAP? IMAP is currently most important for us.
>>
>> The reason I want to do this is we have a custom CRM tool that has a
>> custom mail database and we want to slowly migrate to a real
>> mailserver, we thought of using Apache JAMES to do synchronisation,
>> because at this time we cannot yet realize a full migration. We want
>> to do this in steps.
>>
>> My ultimate goal, regarding synchronisation, is to receive all events
>> that are occurring in the IMAP part of JAMES, so we can update the
>> status of the messages in our CRM-tool. My goal is also to synchronize
>> changes in the CRM-tool back to IMAP-JAMES. But this can easily be
>> done through an IMAP-session. That shouldn't be a problem.
>>
>> I hope anyone can help me out on this, because I find a lack of
>> documentation regarding this subject.
>>
>> Right now, the only way of doing this seems to me creating database
>> triggers (we're using this with PostgreSQL).
>>
>> Thank you in advance.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
>> For additional commands, e-mail: server-dev-h...@james.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
> For additional commands, e-mail: server-dev-h...@james.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to