1

I am working on SharePoint server 2013. and we want to have the ability for users to send suggestions by email and get these emails saved inside a SharePoint list. now i know that each list can have an in-coming email settings, where you can basically send emails to a list. but i have these questions before start working on this:-

  1. can i map the email fields mainly the email's "From","Subject" & "Body" fields into the list fields.. by saying for example that the email "From" field should be saved inside a site column named "EmailFrom"??

  2. In addition to mapping these fields , can i save the original email as an attachment inside the list item? so when user send an email to a list the email got saved as an attachment inside the list item?

Thanks

1
  1. Yes, you can grab the mail headers using an Event Handler. This will fire when an email is received.

    public override void EmailReceived(SPList list, SPEmailMessage emailMessage, String receiverData) { SPListItem newItem = list.Items.Add(); newItem["EmailFrom"] = emailMessage.Headers["From"] newItem["EmailTo"] = emailMessage.Headers["To"] // etc, etc.... newItem.Update(); }

See here: https://jasear.wordpress.com/2010/11/11/enable-incoming-emails-on-a-custom-sharepoint-list/

  1. Yes, attachments can be saved also. If they're failing, check out the following.

See here: https://technet.microsoft.com/en-us/library/cc262947.aspx#section6

  • my second question is not about saving the attachment , but rahter saving the original email as an attachment inside the list items.. – john Gu Jan 15 '16 at 16:29
  • 1
    You can do the same within the Event Receiver. Save the body text as an attachment. See: stackoverflow.com/questions/1334695/… – jpollar Jan 15 '16 at 17:58
  • thanks for your very helpful explanation .. so can you adivce if this scenario is achievable in SharePoint 2013. Let say a user will send an email to the list, then can i do the following mapping between the email and the list item :- map the email title to be equal to the list item title. map the email body to be equal to the list item Description field. map the email sender to be equal to the list item created by. add the original email as an attachment inside the list item. add any attachments inside the email as an attachment to the list item ???? – john Gu Jan 16 '16 at 2:48
  • 1
    Yes. All of that is feasible. You just need custom code in an event receiver to pull it off. – jpollar Jan 18 '16 at 15:09
  • Now i did a test where i added an announcement list and i configure the in-coming email for it. Then i send an email to the list, where i got the following mapping out-of-the-box.1) email sender = item createdBy. 2) email body = item body. 3) email cc = item CC field. 4) the original email (including attachment) will be attached to the item.... – john Gu Jan 19 '16 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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