This project is read-only.

Emailing Documents as attachments in Sharepoint 2010


Thank you for downloading my solution for Sharepoint 2010! I hope you find it does what you’re looking for and that it saves you some time. Feel free to reuse and modify as you see fit.
I love to hear from people who have downloaded and installed it – please let me know what you’d think it’s missing at!

The compiled WSP file is configured to add this feature to all Document Libraries in the site you deploy it to. This is a security implication that you need to consider as it completely negates the security policies that Sharepoint enforces!

To target specific Libraries or Content types, you will need to modify the Elements.xml of the source and recompile the solution into a WSP. Please consult my blog post which explains what you need to change to do this.

Deploying the Solution

Like any WSP file, you can deploy it with a command line using the Sharepoint 2010 Management Shell.

Add-SPSolution “Path to WSP“ 

Install-SPSolution –Identity EmailDocumentsAsAttachments.wsp  –GACDeployment

Configuration & Setup

SMTP Settings

This solution uses the SMTP settings which are configured in the Sharepoint 2010 Central Administration to send the email. If the settings are incorrect then this solution will not work. A good way to verify them is by assigning yourself a task to see if you receive the notification email.

Specifying a From Address

If you want to specify a different address to the one that is actually sending it (i.e. the SMTP settings in Central Administration) then you can override it by adding a value to the HiddenField control with ID “hdnFromAddress” in the EmailDocuments.aspx file in the solution folder.

The solution folder is located in the 14 Hive Layouts folder called “EmailDocumentsAsAttachments”.

Removing the External email addresses / Internal users fields from the Form

If you want to only allow one type of recipient (internal/external) then you can remove the unnecessary field from the form by making the container panel invisible in the EmailDocuments.aspx file in the solution folder.
E.g If you only want to allow internal users then you add a visible=”false” to the Panel with ID “panExternalEmails”.



If there is an error when sending the email, a trace message will be written to the Sharepoint 2010 ULS log. Navigate to the Sharepoint log folder and open the relevant log file. Search for the term “EmailDocumentsAsAttachments” to find the messages written by this solution.

Known Issues

After installing, if you have problems sending an email then try explicitly setting the From address in EmailDocuments.aspx as described above. If your SMTP server is set up in a certain way, the solution may not be able to retrieve the From address from the settings configured in Central Administration, and this is required to construct and send an email.

Last edited Jun 27, 2012 at 4:06 PM by JohnMcAvinue, version 5


No comments yet.