SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to change the behavior of the "send to"-drop-down in a DL from "E-Mail a link" to "E-Mail as attachment"?

share|improve this question
SmtpClient is not available from a sandboxed solution:… SPUtility.SendEmail() doesn't allow attachments either. @Flash265 did you find an appropriate workaround? – SilverlightFox Dec 9 '11 at 17:05
up vote 5 down vote accepted

If you want to send a document as an attachment, you will need to write custom code. Use a feature to create a custom action that adds the "Send as attachment" link to the ECM.

<UrlAction Url="~site/_layouts/MyApp/MyCustomPage.aspx?ItemId={ItemId}&amp;ListId={ListId}" />

Clicking this menu item navigates to a custom application page where the user enters the email address/subject/email-body. The code-behind constructs the email and creates the attachment based on the current item and then sends the email.

using System.Net.Mail;

// get current list and item from query string
string listId = Request.QueryString["ListId"];
SPList list = this.Web.Lists[new Guid(listId)];
string itemId = Request.QueryString["ItemId"];
SPListItem item = list.Items.GetItemById(Convert.ToInt32(itemId));

// get from, to, subject, and body from your aspx page and use to construct mail message
MailMessage msg = new MailMessage(from, to, subject, body);

// create attachment from current item
Stream ms = new MemoryStream(item.File.OpenBinary());
msg.Attachments.Add(new Attachment(ms, item.File.Name));

// send email
SmtpClient smtp = new SmtpClient("yourSMTPserver");
share|improve this answer
Thank your for your answer Laurie. I will try that out asap. Does this work as a sandbox solution? I don't have farm access in the enviroment where I need it. – Flash265 Jun 15 '11 at 10:01

Try to use custom WF Activity : "SharePoint 2010 - Send Email With Attachment" :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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