Monday, September 10, 2012

Sending emails between SharePoint lists

(Also thought of as SharePoint Workflows emailing other SharePoint Lists.)

Situation: Wanted to have a single list at the root site where users can submit ideas and problems that should go to IT for review. We figured we would place a simple list there, use the masterpage to create a link at the bottom, and have this list workflow email our own IT Tickets announcements list (different site). One problem: MS built SharePoint so that it will not recognize emails sent to it from itself (security feature for possible infinite loops- KB970818).

Resolution: There is a resolution out there that involves a VB script placed on the SharePoint server to strip out the SharePoint-y part of the email....I thought that (since I've got Exchange in my environment) I could just use what is known as a "transport rule" to strip out the same stuff so that I don't have to worry about configuring SharePoint all the time. See, here's the deal - when SharePoint sends emails it adds a special header that you don't normally see (in Outlook 2010, you have to open an email and hit File -> Properties to see the message headers). This special header is titled "X-Mailer" and acts like a little field and SharePoint puts inside this field "Microsoft SharePoint" something or another. So I had our exchange administrator setup a transport rule that says "If an email has an X-Mailer header with the word "SharePoint" in it and is being sent to an address that ends in @sharepoint.mydomain.com then remove the X-Mailer header". That's it!

Just to clarify - this would allow me to have two lists email each other in an infinite loop...so your SharePoint admin may not be a fan if you have a large environment and people could setup this sort of thing...only use if you have a structure in-place that would prevent that from happening :)