Customer sometimes wanna send an email with their documents as attachment. If the documents are stored in a a SharePoint library, there is a small difference than if they are stored in a folder on the server. So this piece of code might help you to send the mail including the attached file from SharePoint library. The important step is to use the WebClient and Download Data method.
[sourcecode language=”csharp”]
WebClient webClient = new WebClient();
webClient.Credentials = CredentialCache.DefaultNetworkCredentials;
fileUrl = “your SharePoint File Path absolute”;
byte[] data = webClient.DownloadData(fileUrl);
MemoryStream fs = new MemoryStream(data);
fileName = “Your filename.xx”;
attachment = new Attachment(fs, fileName);
mail.Attachments.Add(attachment);
[/sourcecode]
Hope it helps you.
If you use sharepoint on premise and sharepoint 2013 patform you can use this activitydeploy.com