I have been struggling with a small but irritating problem for a while now and suddenly I ran out of ideas.
I have implemented an email event receiver in Sharepoint 2010. The event receiver creates folders and extracts all attachments when an email is received. Each email is then represented by a folder that contains the email as an eml file and the attachments as files.
Now to the problem. If a user sets up alerts for this library he/she will get an alert for each of the attachments which could be something like 10 alerts just for one email. We only want to send alerts for the eml file. If this would have been an ordinary event receiver then I would have used
this.EventFiringEnabled = false;
//do stuff
this.EventFiringEnabled = true;
but SPEmailEventReceiver does not inherit the same class as an ordinary event receiver. In fact the SPEmailEventReceiver is called form a completely different thread. How do I solve this?