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. Sending Email (Using ASP.Net with C# Language)

Sending Email (Using ASP.Net with C# Language)

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netlearning
10 Posts 5 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.
  • M Offline
    M Offline
    misCafe
    wrote on last edited by
    #1

    hello everyone, i'm looking for code (asp.net with c sharp) to send email on web. many thanks, asp.net beginner

    C S A J 4 Replies Last reply
    0
    • M misCafe

      hello everyone, i'm looking for code (asp.net with c sharp) to send email on web. many thanks, asp.net beginner

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

      I wrote an article on how to use google, it's here on Code Project. You should read it. Sending an email is both so trivial, and so widely documented, that I used it as the example in showing how to find basic information on the internet. ASP.NET also cannot send email, your website will use .NET code that does not depend on ASP.NET

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      1 Reply Last reply
      0
      • M misCafe

        hello everyone, i'm looking for code (asp.net with c sharp) to send email on web. many thanks, asp.net beginner

        S Offline
        S Offline
        saanj
        wrote on last edited by
        #3

        Hi, Check out this article: http://www.microsoft.com/belux/msdn/nl/community/columns/ceulemans/sendhtmlemail.mspx[^]

        Either you love IT or leave IT...

        1 Reply Last reply
        0
        • M misCafe

          hello everyone, i'm looking for code (asp.net with c sharp) to send email on web. many thanks, asp.net beginner

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          misCafe wrote:

          i'm looking for code (asp.net with c sharp) to send email on web.

          Before post, please go through the forums guide lines. Did you search google before post it? Check Here

          cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

          1 Reply Last reply
          0
          • M misCafe

            hello everyone, i'm looking for code (asp.net with c sharp) to send email on web. many thanks, asp.net beginner

            J Offline
            J Offline
            Johan Lundqvist
            wrote on last edited by
            #5

            Hi, Here is a short example: var smtp = new SmtpClient { Host = ConfigurationManager.AppSettings["smtpserver"]}; var mail = new MailMessage { From = new MailAddress("me@me.com") }; mail.To.Add(new MailAddress("some@email.com")); mail.Bcc.Add(mail.From); mail.Body = "Testing"; mail.IsBodyHtml = true; mail.Subject = "Subject"; try { smtp.Send(mail); } catch (SmtpException) { //Error handling here } Hope that this helps.

            M 1 Reply Last reply
            0
            • J Johan Lundqvist

              Hi, Here is a short example: var smtp = new SmtpClient { Host = ConfigurationManager.AppSettings["smtpserver"]}; var mail = new MailMessage { From = new MailAddress("me@me.com") }; mail.To.Add(new MailAddress("some@email.com")); mail.Bcc.Add(mail.From); mail.Body = "Testing"; mail.IsBodyHtml = true; mail.Subject = "Subject"; try { smtp.Send(mail); } catch (SmtpException) { //Error handling here } Hope that this helps.

              M Offline
              M Offline
              misCafe
              wrote on last edited by
              #6

              Thanks for your code. Anyways, how to code if we set validation for email if it doesn't contain "@"? Visoth

              J 1 Reply Last reply
              0
              • M misCafe

                Thanks for your code. Anyways, how to code if we set validation for email if it doesn't contain "@"? Visoth

                J Offline
                J Offline
                Johan Lundqvist
                wrote on last edited by
                #7

                Hi, If you collects the e-mail adress from a web form you can use a RegularExpressionValidator like this: If you would like to check at the server level you can use a simple emailstring.Contains("@") to check before you try to send it.

                M 1 Reply Last reply
                0
                • J Johan Lundqvist

                  Hi, If you collects the e-mail adress from a web form you can use a RegularExpressionValidator like this: If you would like to check at the server level you can use a simple emailstring.Contains("@") to check before you try to send it.

                  M Offline
                  M Offline
                  misCafe
                  wrote on last edited by
                  #8

                  I understand your explain! Would you mind to give me your personal email address? Many thanks, Visoth

                  J 1 Reply Last reply
                  0
                  • M misCafe

                    I understand your explain! Would you mind to give me your personal email address? Many thanks, Visoth

                    J Offline
                    J Offline
                    Johan Lundqvist
                    wrote on last edited by
                    #9

                    Hi, That I can do, don't want to post it here though. Could you reply to this with a private message with your adress?

                    M 1 Reply Last reply
                    0
                    • J Johan Lundqvist

                      Hi, That I can do, don't want to post it here though. Could you reply to this with a private message with your adress?

                      M Offline
                      M Offline
                      misCafe
                      wrote on last edited by
                      #10

                      Thanks for your afford! Hope that you'll always answer my questions. Many thanks, Visoth

                      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