Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Attach file and send it as an email

Attach file and send it as an email

Scheduled Pinned Locked Moved ASP.NET
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    flyingpigaslym
    wrote on last edited by
    #1

    How do you create a form to attach a file and then send it as an email with an attachment? Im hoping to send it to my hotmail account. Any help would be appreciated. thanks

    J 1 Reply Last reply
    0
    • F flyingpigaslym

      How do you create a form to attach a file and then send it as an email with an attachment? Im hoping to send it to my hotmail account. Any help would be appreciated. thanks

      J Offline
      J Offline
      john nada
      wrote on last edited by
      #2

      I don't know what to do exactly without trying it myself, but maybe this can get you started in the right direction.. To upload a file put a file field on your form: When the page is posted back to the server you can access the uploaded file by calling the PostedFile property of the file field: fileUpload.PostedFile Use the InputStream property of the PostedFile to do whatever you have to, for example: Dim img As System.Drawing.Image img = img.FromStream(fileUpload.PostedFile.InputStream) Create the email: Dim email as New System.Web.Mail.MailMessage email.Attachements.Add(img) email.From = "from@hotmail.com" email.To = "to@hotmail.com" email.Subject = "test" email.Body = "hi" Send the email (make sure the Smtp service is running in your IIS server): SmtpMail.Send(email)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups