Sending Mail with Attachment in SharePoint 2010
string smtpServer = SPAdministrationWebApplication .Local.OutboundMailServiceInstance.Server.Address; string smtpFrom = SPAdministrationWebApplication .Local.OutboundMailSenderAddress; string Email= "EmailID" MailMessage mailMessage = new MailMessage (smtpFrom, Email); mailMessage.Subject = txtSubject.Text; mailMessage.Body = txtBody.Text; WebClient webClient = new WebClient (); webClient.Credentials = CredentialCache .DefaultNetworkCredentials; FileStream fs = new FileStream (pathToCheck, FileMode .Open, FileAccess .Read); byte [] data = new byte [fs.Length]; fs.Read(data, 0, data.Length); MemoryStream memoryStreamOfFile = new MemoryStream (data); mailMessage.Atta