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

how to send any document as attachment in the email in share point. On click of button, email with attachment should be sent.

share|improve this question

You can make use of Dot Net System.Net.Mail

//Get the Sharepoint SMTP information from the SPAdministrationWebApplication
string smtpServer = SPAdministrationWebApplication.Local.OutboundMailServiceInstance
string smtpFrom = SPAdministrationWebApplication.Local.OutboundMailSenderAddress;
//Create the mail message and supply it with from and to info
MailMessage mailMessage = new MailMessage(smtpFrom, insert_receiver);

//Set the subject and body of the message
mailMessage.Subject = insert_subject;
mailMessage.Body = insert_body;

//Download the content of the file with a WebClient
WebClient webClient = new WebClient();

//Supply the WebClient with the network credentials of our user
webClient.Credentials = CredentialCache.DefaultNetworkCredentials;

//Download the byte array of the file
byte[] data = webClient.DownloadData(insert_ attachment_url);

//Dump the byte array in a memory stream because
//we can write it to our attachment
MemoryStream memoryStreamOfFile = new MemoryStream(data);

//Add the attachment
mailMessage.Attachments.Add(new System.Net.Mail.Attachment(memoryStreamOfFile, insert_filename_attachment, insert_content_type));

//Create the SMTP client object and send the message
SmtpClient smtpClient = new SmtpClient(smtpServer);


share|improve this answer
Thanks @Nadeem Yousuf, i used document/pdf for insert_content_type for including pdf as attachment, but when i get the mail, it is not in pdf format, can anybody let me know, how to include pdf as attachment. – Chandan Banakar Feb 6 '13 at 6:23

Try to use "SharePoint 2010 - Send Email With Attachment" custom WF activity.

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.