How do I use SPEmailEventReceiver to parse data from email
I have an email enabled document library that receives emails with documents attached. I want to group and filter these emails and attachments using the domain name they arrived from. This means I need to strip the domain name from the sender's email address i.e. paul.shadwell@techvee.开发者_Python百科com returns techvee.com.
I would also like to parse information from the email's signature to create a contact record in a separate contact list.
I would be very grateful for some help and guidance on this.
Best regards
Paul J Shadwell
You can implement your own SPEmailEventReceiver.
public class MailEvents : SPEmailEventReceiver
Override the EmailReceived event
public override void EmailReceived(SPList list, Microsoft.SharePoint.Utilities.SPEmailMessage emailMessage, string receiverData)
What I would do is to write the logic for handling your mails in this event handler and let it move the mail to another document library. So basically you would have an incoming e-mail library that will receive all e-mails. With the event handler attached to it, you can perform your business logic by copying/moving the mail to another document library of your choice.
Remember to attach to owstimer.exe for debugging this class!
Maarten
精彩评论