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. plzz write a simple function on..........

plzz write a simple function on..........

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorial
9 Posts 7 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
    manish srivastava
    wrote on last edited by
    #1

    plzz write a simple function how to make a e-mail function in asp.net. the function should accept, to, from,subject & message string and send e-mail using ASP.NET.

    E R S 3 Replies Last reply
    0
    • M manish srivastava

      plzz write a simple function how to make a e-mail function in asp.net. the function should accept, to, from,subject & message string and send e-mail using ASP.NET.

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      Ok, I finished it. Now what?

      C 1 Reply Last reply
      0
      • M manish srivastava

        plzz write a simple function how to make a e-mail function in asp.net. the function should accept, to, from,subject & message string and send e-mail using ASP.NET.

        R Offline
        R Offline
        rockford boulderdash
        wrote on last edited by
        #3

        There you go, enjoy :) ============================================= using System.Net.Mail; public static void SendMailMessage(string sMailBody, string sFromAddress, string sFromName, string[] sToAddress, string[] sCC, string[] sBCC, string sSubject, bool IsHTML) { SmtpClient objSMTPClient = new SmtpClient("localhost"); MailMessage objMessage = new MailMessage(); try { MailAddress objFromAddress = new MailAddress(sFromAddress, sFromName); // From address will be given as a MailAddress Object objMessage.From = objFromAddress; // To address collection of MailAddress for (int i = 1; i <= sToAddress.Length; i++) { objMessage.To.Add(sToAddress[i - 1]); } // CC and BCC optional // MailAddressCollection class is used to send the email to various users // You can specify Address as new MailAddress("user@host.com") if (sCC != null) { if (sCC.Length > 0) { for (int i = 1; i <= sCC.Length; i++) { objMessage.CC.Add(sCC[i - 1]); } } } if (sBCC != null) { if (sBCC.Length > 0) { for (int i = 1; i <= sBCC.Length; i++) { objMessage.Bcc.Add(sBCC[i - 1]); } } } // Body can be html or text format if (IsHTML) objMessage.IsBodyHtml = true; objMessage.Subject = sSubject; objMessage.Body = sMailBody; // Send SMTP mail objSMTPClient.Send(objMessage); } catch { } } My blog: http://www.asaf.co.il

        N 1 Reply Last reply
        0
        • R rockford boulderdash

          There you go, enjoy :) ============================================= using System.Net.Mail; public static void SendMailMessage(string sMailBody, string sFromAddress, string sFromName, string[] sToAddress, string[] sCC, string[] sBCC, string sSubject, bool IsHTML) { SmtpClient objSMTPClient = new SmtpClient("localhost"); MailMessage objMessage = new MailMessage(); try { MailAddress objFromAddress = new MailAddress(sFromAddress, sFromName); // From address will be given as a MailAddress Object objMessage.From = objFromAddress; // To address collection of MailAddress for (int i = 1; i <= sToAddress.Length; i++) { objMessage.To.Add(sToAddress[i - 1]); } // CC and BCC optional // MailAddressCollection class is used to send the email to various users // You can specify Address as new MailAddress("user@host.com") if (sCC != null) { if (sCC.Length > 0) { for (int i = 1; i <= sCC.Length; i++) { objMessage.CC.Add(sCC[i - 1]); } } } if (sBCC != null) { if (sBCC.Length > 0) { for (int i = 1; i <= sBCC.Length; i++) { objMessage.Bcc.Add(sBCC[i - 1]); } } } // Body can be html or text format if (IsHTML) objMessage.IsBodyHtml = true; objMessage.Subject = sSubject; objMessage.Body = sMailBody; // Send SMTP mail objSMTPClient.Send(objMessage); } catch { } } My blog: http://www.asaf.co.il

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          You took all the fun out of having him do the research and actually LEARN something. ;P


          only two letters away from being an asset

          R 1 Reply Last reply
          0
          • N Not Active

            You took all the fun out of having him do the research and actually LEARN something. ;P


            only two letters away from being an asset

            R Offline
            R Offline
            rockford boulderdash
            wrote on last edited by
            #5

            He can learn a lot from the code snippest... (At least I hope :doh: )

            N 1 Reply Last reply
            0
            • R rockford boulderdash

              He can learn a lot from the code snippest... (At least I hope :doh: )

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              He'll learn to copy and paste


              only two letters away from being an asset

              _ 1 Reply Last reply
              0
              • M manish srivastava

                plzz write a simple function how to make a e-mail function in asp.net. the function should accept, to, from,subject & message string and send e-mail using ASP.NET.

                S Offline
                S Offline
                saravanan05
                wrote on last edited by
                #7

                hi refer this link; http://www.codeproject.com/aspnet/SivaEMailSample.asp[^] regards saravanan

                1 Reply Last reply
                0
                • E ednrgc

                  Ok, I finished it. Now what?

                  C Offline
                  C Offline
                  Colin Angus Mackay
                  wrote on last edited by
                  #8

                  ednrgc wrote:

                  Ok, I finished it. Now what?

                  :laugh:


                  Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                  1 Reply Last reply
                  0
                  • N Not Active

                    He'll learn to copy and paste


                    only two letters away from being an asset

                    _ Offline
                    _ Offline
                    _AK_
                    wrote on last edited by
                    #9

                    yep that is correct he should have tried it first and then in case of problem should have asked here.

                    Best Regards, Apurva Kaushal

                    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