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. Send email attachment

Send email attachment

Scheduled Pinned Locked Moved ASP.NET
question
3 Posts 3 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.
  • V Offline
    V Offline
    VK Link
    wrote on last edited by
    #1

    Hi - How would we send email attachments from a web form? I tried: Dim fileattachment_1 = file.PostedFile Dim strPath As String strPath = Path.GetFullPath(fileattachment_1.Filename) objAttach = New MailAttachment(strPath) msg.Attachments.Add(objAttach) And then sent it. Many thanks.

    M V 2 Replies Last reply
    0
    • V VK Link

      Hi - How would we send email attachments from a web form? I tried: Dim fileattachment_1 = file.PostedFile Dim strPath As String strPath = Path.GetFullPath(fileattachment_1.Filename) objAttach = New MailAttachment(strPath) msg.Attachments.Add(objAttach) And then sent it. Many thanks.

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      HI there. You'll have to save the PostedFile to the server's disk first, then use the absolute path of the saved file when creating your MailAttachment.

      1 Reply Last reply
      0
      • V VK Link

        Hi - How would we send email attachments from a web form? I tried: Dim fileattachment_1 = file.PostedFile Dim strPath As String strPath = Path.GetFullPath(fileattachment_1.Filename) objAttach = New MailAttachment(strPath) msg.Attachments.Add(objAttach) And then sent it. Many thanks.

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        You may need to called PostedFile.SaveAs (to a temporary File location). Perhaps you can use Temporary Path. Then send the attachment. After the email is sent, you can delete the file. Vasudevan Deepak Kumar Personal Web: http://www.lavanyadeepak.tk/ I Blog At: http://www.dotnetjunkies.com/weblog/deepak/
        http://deepakvasudevan.blogspot.com/
        http://deepak.blogdrive.com/

        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