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 emails in asp.net(without IIS throught smtp)

how to send emails in asp.net(without IIS throught smtp)

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netwindows-admintutorial
13 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.
  • N Not Active

    You don't need to configure IIS. The SmtpMail[^] class has a static property used to set the SMTP server to send mail through. You can also configure this in the web.config file in the mailSettings[^] element


    No comment

    M Offline
    M Offline
    MalarGayu
    wrote on last edited by
    #3

    hi thanks for the reply as per the link u gave i wrote this in my web.config file and in my code i wrote this: MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = "smtp.domain.com"; SmtpMail.Send(msgMail); but still not working can you plz help me... K.Gayathri

    N 1 Reply Last reply
    0
    • M MalarGayu

      hi friends i need to send mails from an asp.net application using c# but my IIS is not configured in my laptop so how to send mails can anyone help me in this issue plz.. K.Gayathri

      D Offline
      D Offline
      Dalek Dave
      wrote on last edited by
      #4

      This my help[^]

      ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

      M M 2 Replies Last reply
      0
      • M MalarGayu

        hi thanks for the reply as per the link u gave i wrote this in my web.config file and in my code i wrote this: MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = "smtp.domain.com"; SmtpMail.Send(msgMail); but still not working can you plz help me... K.Gayathri

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

        You have to give a better explanation than "it doesn't work". One guess is you are using localhost as the smtp server and I doubt very much your local machine is an email server or configured as a relay. Format your code snippets when posting


        No comment

        1 Reply Last reply
        0
        • D Dalek Dave

          This my help[^]

          ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

          M Offline
          M Offline
          Manfred Rudolf Bihy
          wrote on last edited by
          #6

          Warez yo grandmar dizzapeered to?

          "With sufficient thrust, pigs fly just fine."

          Ross Callon, The Twelve Networking Truths, RFC1925

          1 Reply Last reply
          0
          • D Dalek Dave

            This my help[^]

            ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

            M Offline
            M Offline
            MalarGayu
            wrote on last edited by
            #7

            hi thanks for the reply my problem is i am not able to connect to the smtp server can anyone help me out my code is: in my web.config file i have: my asp.net c# code is MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = System.Configuration.ConfigurationManager.AppSettings["SMTPServer"]; SmtpMail.Send(msgMail); K.Gayathri

            N 1 Reply Last reply
            0
            • M MalarGayu

              hi thanks for the reply my problem is i am not able to connect to the smtp server can anyone help me out my code is: in my web.config file i have: my asp.net c# code is MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = System.Configuration.ConfigurationManager.AppSettings["SMTPServer"]; SmtpMail.Send(msgMail); K.Gayathri

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #8
              1. Format your code snippets when posting 2) Don't repeat the question/reply in multiple places 3) I gave you the answer.

              No comment

              M 1 Reply Last reply
              0
              • N Not Active
                1. Format your code snippets when posting 2) Don't repeat the question/reply in multiple places 3) I gave you the answer.

                No comment

                M Offline
                M Offline
                MalarGayu
                wrote on last edited by
                #9

                hi i am having my .net application running in my system and i need to send a mail (eg to test to my email id itself). so i am sending an email from my .net application to my email address hope u got my question now.. i am getting the error a smtp not connected... K.Gayathri

                N 1 Reply Last reply
                0
                • M MalarGayu

                  hi i am having my .net application running in my system and i need to send a mail (eg to test to my email id itself). so i am sending an email from my .net application to my email address hope u got my question now.. i am getting the error a smtp not connected... K.Gayathri

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

                  I get your question, I got it the first time. Yes, you have an email address. Good for you. However, your local machine is NOT an email server. ASP.NET and IIS don't just magically route emails around the world. You NEED an email server send an email. Do you get my response? Let me repeat. Your local machine, ie localhost, is NOT an email server.


                  No comment

                  M 1 Reply Last reply
                  0
                  • N Not Active

                    I get your question, I got it the first time. Yes, you have an email address. Good for you. However, your local machine is NOT an email server. ASP.NET and IIS don't just magically route emails around the world. You NEED an email server send an email. Do you get my response? Let me repeat. Your local machine, ie localhost, is NOT an email server.


                    No comment

                    M Offline
                    M Offline
                    MalarGayu
                    wrote on last edited by
                    #11

                    ya i got what u r saying for that only i am trying to use smtp to send mails (is it ok) so now tell me how to send emails..hope u would have got my code from my previous posting.. K.Gayathri

                    N 1 Reply Last reply
                    0
                    • M MalarGayu

                      ya i got what u r saying for that only i am trying to use smtp to send mails (is it ok) so now tell me how to send emails..hope u would have got my code from my previous posting.. K.Gayathri

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

                      MalarGayu wrote:

                      how to send emails

                      Use a valid SMTP server or configure a relay :rolleyes: Instead of continuing to post these questions why don't you spend some time researching. You have been given enough information. I'll get you started[^]


                      No comment

                      1 Reply Last reply
                      0
                      • M MalarGayu

                        hi friends i need to send mails from an asp.net application using c# but my IIS is not configured in my laptop so how to send mails can anyone help me in this issue plz.. K.Gayathri

                        Y Offline
                        Y Offline
                        yoager
                        wrote on last edited by
                        #13

                        your local machine is NOT an email server. ASP.NET and IIS don't just magically route emails around the world. You NEED an email server send an email.

                        health

                        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