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. email/sms

email/sms

Scheduled Pinned Locked Moved ASP.NET
csharpdesign
8 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.
  • B Offline
    B Offline
    bhadilov
    wrote on last edited by
    #1

    i have a webpg where our employers can send an email to the clients. i have designed the relevant UI but need the code to send an email to the appropriate recipient when our users clicks the "SEND EMAIL" button. using C#

    A A M 3 Replies Last reply
    0
    • B bhadilov

      i have a webpg where our employers can send an email to the clients. i have designed the relevant UI but need the code to send an email to the appropriate recipient when our users clicks the "SEND EMAIL" button. using C#

      A Offline
      A Offline
      AhsanS
      wrote on last edited by
      #2

      Google gives thousands of results.

      Ahsan Ullah Senior Software Engineer MCTS 2.0

      1 Reply Last reply
      0
      • B bhadilov

        i have a webpg where our employers can send an email to the clients. i have designed the relevant UI but need the code to send an email to the appropriate recipient when our users clicks the "SEND EMAIL" button. using C#

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

        This is one of the most used and common functionality in any application. You have to use Following namespace,

        Using System.Net.Mail

        Sample Code :

            MailMessage Mail = new MailMessage();
            MailAddress mailAdd = new MailAddress(txtFrom.Text,txtName.Text);
            Mail.From = mailAdd ;
            Mail.To.Add(txtTo.Text);
            Mail.Subject = txtSubject.Text;
            Mail.Body = txtComment.Text;
           try
            {
                SmtpClient Objsmtp = new SmtpClient();
            Objsmtp .Host = "myMailServer"; 
                Objsmtp .Send(Mail);
              
            }
            catch (Exception ex)
            {
                //Handel Exception
            }
        

        If you serach google, you will get many example on same. :) Note : Please configure your SMTP Serverproperly before starting and testing it.

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article

        B 1 Reply Last reply
        0
        • B bhadilov

          i have a webpg where our employers can send an email to the clients. i have designed the relevant UI but need the code to send an email to the appropriate recipient when our users clicks the "SEND EMAIL" button. using C#

          M Offline
          M Offline
          Manas Bhardwaj
          wrote on last edited by
          #4

          bhadilov wrote:

          but need the code to send an email to the appropriate recipient when our users clicks the "SEND EMAIL" button

          Ever heard of Google[^]?

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          B 1 Reply Last reply
          0
          • A Abhijit Jana

            This is one of the most used and common functionality in any application. You have to use Following namespace,

            Using System.Net.Mail

            Sample Code :

                MailMessage Mail = new MailMessage();
                MailAddress mailAdd = new MailAddress(txtFrom.Text,txtName.Text);
                Mail.From = mailAdd ;
                Mail.To.Add(txtTo.Text);
                Mail.Subject = txtSubject.Text;
                Mail.Body = txtComment.Text;
               try
                {
                    SmtpClient Objsmtp = new SmtpClient();
                Objsmtp .Host = "myMailServer"; 
                    Objsmtp .Send(Mail);
                  
                }
                catch (Exception ex)
                {
                    //Handel Exception
                }
            

            If you serach google, you will get many example on same. :) Note : Please configure your SMTP Serverproperly before starting and testing it.

            Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article

            B Offline
            B Offline
            bhadilov
            wrote on last edited by
            #5

            thanx jana.. i see why you da code MVP. well any ideas how i could get a free SMTP server cause we are still starting up and dont have the funds for the monthly rentals on the ones available on the net.. :thumbsup: :-D

            A N 2 Replies Last reply
            0
            • M Manas Bhardwaj

              bhadilov wrote:

              but need the code to send an email to the appropriate recipient when our users clicks the "SEND EMAIL" button

              Ever heard of Google[^]?

              Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

              B Offline
              B Offline
              bhadilov
              wrote on last edited by
              #6

              well manas. if you cared to read properly or checked google. the SMTP servers are for rental.. as i stated we dont have the funds so if you aint got anything better to rply with.. go fly a kite :-D

              1 Reply Last reply
              0
              • B bhadilov

                thanx jana.. i see why you da code MVP. well any ideas how i could get a free SMTP server cause we are still starting up and dont have the funds for the monthly rentals on the ones available on the net.. :thumbsup: :-D

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

                bhadilov wrote:

                how i could get a free SMTP server

                Thats depedens of which IIS Server (IIS 6.0 or IIS 7.0 ) you are using. Here is some article, which I prefer to give other who are just trying to configure SMTP, SMTP Server Setup (IIS 6.0) and Configuring the SMTP Server Hope this will help you to move ahead :-D Let me know if you have face any problem :)

                Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you. View My Latest Article

                1 Reply Last reply
                0
                • B bhadilov

                  thanx jana.. i see why you da code MVP. well any ideas how i could get a free SMTP server cause we are still starting up and dont have the funds for the monthly rentals on the ones available on the net.. :thumbsup: :-D

                  N Offline
                  N Offline
                  N a v a n e e t h
                  wrote on last edited by
                  #8

                  bhadilov wrote:

                  well any ideas how i could get a free SMTP server

                  Gmail has free SMTP support. :)

                  Navaneeth How to use google | Ask smart questions

                  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