0

I created a Email Event receiver for a list which creates a DocumentSet and drops the mail message as .eml file in the DocumentSet. Attachments will also be dropped inside the DocumentSet. So far so good... The mail will be send to the list from a client application. The client application simply forwards a user mail to a sharepoint list depending on the subject. User mail with attachments --> application --> sharepoint list with mail receiver

I got a requirement to set the sender address as a metadata value. My problem here is, that I only receive the address of the application which forwards the mail.

Is it possible to get the base mail message which was send to the application? Or only the sender which originally has send the message?

Thank you very much!

2
  • 1
    You're using the values on SPEmailMessage.Headers right? Can you download a version of the email and look at the raw view of the email that was received to see all of the headers that came with it and make sure what you want is in the email to begin with. Commented Mar 27, 2014 at 21:23
  • hi, I checked all SPEmailHeaders. None of the headers holds the information I'm looking for :( any ideas?
    – ReTech
    Commented Apr 1, 2014 at 13:18

1 Answer 1

0

So SPEmailMessage.Headers usually does not contain all of the information that is sent with the email (annoying right?). What it does have is a method that allows you to get a stream of the original email message SPEmailMessage.GetMessageStream(). I would use this to populate an object of type System.Net.Mail.MailMessage and then you should be able to access everything that was sent in the original message. Take a look at this codeplex tool it may do a lot of the heavy lifting for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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