Skip to content

Instantly share code, notes, and snippets.

@timothyclifford
Created February 24, 2012 05:39
Show Gist options
  • Select an option

  • Save timothyclifford/1898055 to your computer and use it in GitHub Desktop.

Select an option

Save timothyclifford/1898055 to your computer and use it in GitHub Desktop.
.net email attachment from posted file
string fileName = Path.GetFileName(UploadedFile.PostedFile.FileName);
Attachment attachment = new Attachment(UploadedFile.FileContent, fileName);
myMailMessage.Attachments.Add(attachment);
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMailMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment