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. How to send mail with attachments in ASP.net

How to send mail with attachments in ASP.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorialquestion
6 Posts 4 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.
  • N Offline
    N Offline
    ngrj
    wrote on last edited by
    #1

    Hi Friends how can i send Email with files attached in asp.net by opening a file dialog when ADD button is clicked Thanks in advance

    C A 2 Replies Last reply
    0
    • N ngrj

      Hi Friends how can i send Email with files attached in asp.net by opening a file dialog when ADD button is clicked Thanks in advance

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I would imagine that if you're sending the mail from the server, you need to select files one at a time with the file dialog and copy them to the server. Otherwise, use a mailto tag and let users attach files in outlook. Unless the file is on the server already, then you don't need the file dialog, you need your own list of files. Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • N ngrj

        Hi Friends how can i send Email with files attached in asp.net by opening a file dialog when ADD button is clicked Thanks in advance

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Hi This is the code in ASP.Net to send email with attachments Dim mailMessage As New MailMessage() 'creating an instance of the MailMessage class mailMessage.From = "xyz@mydomain.com" 'senders email address mailMessage.To = "xyz@abc.com;san@universe.com;sen@baw.com" 'multiple recipient's mailMessage.Cc = "carboncopy@sendersemail.com" 'email address of the Cc recipient mailMessage.Bcc = "blindcarboncopy@sendersemail.com" 'email address of the Bcc recipient mailMessage.Subject = "Hello" 'subject of the email message mailMessage.BodyFormat = MailFormat.HTML 'HTML message format mailMessage.Body = "" & "This tutorial is sending an HTML email_ with an ASP.NET app." & "" 'message body, html message Dim Attach As MailAttachment = New MailAttachment("C:\images\sun.gif") mailMessage.Attachments.Add(Attach) 'adding an attachment mailMessage.Priority = MailPriority.Normal 'email priority. Can be low, normal or high SmtpMail.SmtpServer = "mail.yourserver.com" 'mail server used to send this email. modify this line based on your mail server SmtpMail.Send(mailMessage)

        N 1 Reply Last reply
        0
        • A Anonymous

          Hi This is the code in ASP.Net to send email with attachments Dim mailMessage As New MailMessage() 'creating an instance of the MailMessage class mailMessage.From = "xyz@mydomain.com" 'senders email address mailMessage.To = "xyz@abc.com;san@universe.com;sen@baw.com" 'multiple recipient's mailMessage.Cc = "carboncopy@sendersemail.com" 'email address of the Cc recipient mailMessage.Bcc = "blindcarboncopy@sendersemail.com" 'email address of the Bcc recipient mailMessage.Subject = "Hello" 'subject of the email message mailMessage.BodyFormat = MailFormat.HTML 'HTML message format mailMessage.Body = "" & "This tutorial is sending an HTML email_ with an ASP.NET app." & "" 'message body, html message Dim Attach As MailAttachment = New MailAttachment("C:\images\sun.gif") mailMessage.Attachments.Add(Attach) 'adding an attachment mailMessage.Priority = MailPriority.Normal 'email priority. Can be low, normal or high SmtpMail.SmtpServer = "mail.yourserver.com" 'mail server used to send this email. modify this line based on your mail server SmtpMail.Send(mailMessage)

          N Offline
          N Offline
          ngrj
          wrote on last edited by
          #4

          Hi The code u sent works fine for single file but what if i want to send multiple file Thanks in Advance

          A 1 Reply Last reply
          0
          • N ngrj

            Hi The code u sent works fine for single file but what if i want to send multiple file Thanks in Advance

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            You add Dim Attach As MailAttachment = New MailAttachment("C:\images\sun.gif") mailMessage.Attachments.Add(Attach) as how many times you want to get for multiple files attachment

            N 1 Reply Last reply
            0
            • A Anonymous

              You add Dim Attach As MailAttachment = New MailAttachment("C:\images\sun.gif") mailMessage.Attachments.Add(Attach) as how many times you want to get for multiple files attachment

              N Offline
              N Offline
              nit115
              wrote on last edited by
              #6

              Are you having problems with an AOL browser. I can't get it to send files. Nits

              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