Thursday, May 8, 2008

Incoming e-mail feature in SharePoint 2007

I am pretty excited about enabling incoming e-mail feature in our SharePoint production environment in this week ends finally. We have really tested it thoroughly in our SharePoint stage environment before enabling it in production envionment. In fact, we follow this process all the time to be on safe side :-)

Alright, so we will talk about incoming e-mail feature and e-mail enabled lists and libraries in SharePoint 2007 today.

Before I start, let me tell you that we do NOT have MS Exchange server setup in our organization for e-mail routing but we have unix based mail routing system called - Majordomo. So it may differ from configuring incoming e-mail feature in MOSS 2007 with Microsoft recommended mail routing system- MS Exchange.

As you all know we can enable incoming e-mail in MOSS 2007 by going to Central Administration > Operations > Incoming E-Mail Settings. Here is how we have configured it,

1. Enable sites on this server to receive e-mail? Yes

2. Settings mode: Automatic

3. Use the SharePoint Directory Management Service to create distribution groups and contacts? Yes

Note: This setting is required ONLY if you want contacts to be created in your organization's user directory allowing people to find e-mail enabled SharePoint lists in their address book. This service also provides support for the creation and management of e-mail distribution groups from SharePoint sites. If you don't want contacts to be created in your organization's user directory you can choose "No". Incoming e-mail feature will work regardless of what you select for this option.

If you have selected "Yes", you need to provide additional information. If you are not sure of this information, please contact the person who manages Active Directory and domain services for your organization. For example, we have

4. Active Directory container where new distribution groups and contacts will be created: OU=SPOU, OU=Organization, OU=ControlledObjects, DC=hq, DC=MyDomainName, DC=com

Note: I have changed few settings to keep the privacy.

5. SMTP mail server for incoming mail: MOSSServer1.hq.MyDomainName.com

6. Accept messages from authenticated users only? Yes (We have enabled incoming e-mail feature for intranet use only however we don't want any spam e-mails in our system when we enable it for external accounts so it is always safe to select "Yes" option here.

7. Allow creation of distribution groups from SharePoint sites? Yes

8. Distribution group request approval settings: Create new distribution group and Delete distribution group are selected.

9. E-mail server display address: sharepoint.hq.MyDomainName.com

Note: This option is little tricky to provide a custom address here. Please note that the SMTP server name for incoming mail is "MOSSServer1" however we want contacts for e-mail enabled lists and libraries with suffix "@sharepoint.hq.MyDomainName.com". We can do this by adding another domain alias in IIS for SMTP Virtual Server. Here are the steps to add the domain alias for SMTP Virtual Server,

(i) Open IIS, where you have SMTP Virtual Server installed.
(ii) Expand Default SMTP Virtual Server.
(iii) Right click on Domains and select New => Domain.
(iv) Select Alias.
(v) Provide Name (Another Alias of this SMTP Virtual Server e.g. we have used sharepoint.hq.MyDomainName.com and click Finish button.

Note: MS Exchange or your mail distribution system (Majordomo in our case) must be configured to route all emails that suffix with @
sharepoint.hq.MyDomainName.com to C:\Inetpub\mailroot\Drop folder of SMTP Virtual Server installed on MOSSServer1.

10. Safe E-Mail Servers: Accept mail from all e-mail servers is selected.

That's it, incoming e-mail feature for MOSS 2007 is configured...Congratulations!

Now, Let's talk about testing this feature...(Please keep in mind that we have Unix based Majordomo mail distribution system in our organization) Most of the time it worked fine for receiving e-mails in SharePoint however we stopped receiving e-mails after 2-3 days of testing. We were unable to telnet into server on port 25. SharePoint server(with Virutal SMTP Server installed) was not listening on port 25. We checked “Connection” property under “Access” tab of SMTP Virtual Server properties and noticed that SMTP server is accepting connection only from 196.X.X.123 server however we configured to receive e-mails from any e-mail server. So We removed that IP Address (196.X.X.123) from the “Computers” tab and set connection settings to “All except the list below” by keeping “Computers” tab empty. After this change, we started receiving e-mails in SharePoint as normal but question was how this change was occurred and who made changes to “Connection” settings? and here is the answer :-)

While testing incoming e-mail feature in SharePoint, we set “Accept mails from these safe e-mail servers” with the above IP Address (196.X.X.123) and that changed “Connection” settings of SMTP Virtual Server in IIS. This was the root cause of this issue. So be very careful when you make any configuration changes to your incoming e-mail settings.

As I mentioned before I am pretty excited about announcing this feature in our SharePoint production enviornment however here are the few things what I am concerned about,

How can we manage undelivered emails?

1. What happens to emails, which are sent to wrong email addresses? SharePoint logs refer that as Unknown Alias. How does SMTP server handles it? Is there anyway we(or SharePoint Admin email account) can get notified for undelivered email messages? We tried to set email account in SMTP server properties for Undelivered emails but that didn't help. We would like sender to receive bounce back email when email is sent to wrong email address or at least SharePoint administrator account get notified when email is not delivered to SharePoint.

2. We have Distribution List set for different groups. Let's say for example, dl-spadmins has all email accounts of SharePoint administrators. If we add email address for SharePoint document library in this DL and then send email to dl-spadmins, all members of that DL receive email but SharePoint document library does NOT receive this email. Is there anyway to troubleshoot this issue?

Why we want to add email address for SharePoint document library to Distribution List (DL)? Because we can not find those contacts in SharePoint even though we have configured Directory Management Service for incoming email feature in SharePoint and that is because we have Majordomo mail distribution system instead of MS Exchange (I believe this is the reason, we can not find those contacts in MS Outlook but I am not sure) So if we add contacts for important SharePoint document libraries to DL of relevant department (Site Collection), anybody can send email to DL, which will send email/document to all the members of DL as well as SharePoint document library and nobody needs to remember email address of SharePoint document library. All they need to do is, just send an email to DL and it will reach both the members of DL and SharePoint document library, which these members are going to access later.

When you add email address of email enabled Document Library to Distribution List(DL), permissions for email must be set to "Accept e-mail messages from any sender" in order to receive email in SharePoint and yes, It shows "System Account" for those messages or the documents received in Document Library. This is already been discussed in this Blog and unfortunately we are still struggling for an appropriate solution. If you set "Save all attachments in folders grouped by e-mail sender" , it creates a new folder for each new sender and then add attachments to that folder however it still shows "System Account" under "Modified By" field but at least it gives you an idea (by looking at the folder name) who sent that email/documents to your Document Library.

If you set "Accept e-mail messages based on document library permissions" then the email will not be received in SharePoint.

One more thing...

If you set "Accept e-mail messages based on document library permissions" option for your Document Library and if somebody, who doesn't have permissions on your Document Library sends an email to your Document Library, it never arrives in your Document Library. Also Sender will not receive any bounce back. So Sender assumes that he has successfully sent an email to your Document Library and you never receive it. Now, this issue might be specific to Majordomo(Unix based) email distribution system and may work well with MS Exchange configuration. I have tested this in my Lab with MS Exchange and I believe it sends the bounce back message if you don't have permissions on the Document Library but I am not 100% sure. :-(

Finally here is the matrix for reusing same contact name for same library or different library in SharePoint,

















References:
http://www.combined-knowledge.com/Downloads%202007.htm
http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=31

No comments: