Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a massive problem that I need to solve. I have a document library that is a catch all dumping ground for emails that are forwarded there by our users out in the field. With in these emails are signatures that will have the original persons email address in, the domain in that address has a discussion board related to it.

So for example Gmail.com has one where I want to put all the address with that domain into one discussion board.

So far I have the following code:

    using System;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Workflow;

namespace EventReceiverProject1.EventReceiver1
{
    /// <summary>
    /// List Email Events
    /// </summary>
    public class EventReceiver1 : SPEmailEventReceiver
    {
       /// <summary>
       /// The list received an e-mail message.
       /// </summary>
       public override void EmailReceived(SPList list, SPEmailMessage emailMessage, String receiverData)
       {
           SPListItem oListItem = list.Items.Add();
           oListItem["Title"] = emailMessage.Headers["Subject"];
           oListItem["Body"] = emailMessage.HtmlBody;
           oListItem.Update();
       }


    }
}

But I'm not sure how I define it and where to put it based on the domain. Here is an example list:

DOMAIN gmail.com, hotmail.com
DISCUSSION BOARD Gmail customers, Hotmail Customers

Any help on this would be a massive help!

Reagards

share|improve this question
    
sorry, am not 100% sure about what your asking for but Custom Column might be the answer ? –  tereško Aug 29 '12 at 11:14
    
Pretty much I need to copy an email that comes into the catch all document library and place it into its correct customer discussion board. Based on an email address it finds inside of an email. –  niceNmilky Sep 3 '12 at 13:13

1 Answer 1

The only solution for this is to write a parser, that will search for forwarded e-mail header in the e-mail content (HtmlBody) and extract original persons e-mail address. It is really a complicated task.

You can search for header markers generated by e-mail client which has forwarded e-mail to your system. Then parse header name / values:

From: address

Sent: date

To: address

Subject: text

Take To or From addresses and make a decision where to put e-mail.

If you have a predefined set of domains for e-mail addresses then you can simplify solution by using regular expressions to check if e-mail body contains e-mail addresses from that domain.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.