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 a email....

how to send a email....

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
8 Posts 3 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.
  • R Offline
    R Offline
    raghvendrapanda
    wrote on last edited by
    #1

    Hy, I have created a email page by using the following code MailMessage msg = new MailMessage(); msg.To = txtTo.Text; msg.From = txtFrom.Text; msg.Subject = txtSubject.Text; msg.Body = txtContent.Value; lblStatus.Text = "Sending..."; SmtpMail.Send(msg); but when i run the page the mail is not sent.... do i have to use SmtpMail.SmtpServer for sending the mail? plz help... regards

    A S 2 Replies Last reply
    0
    • R raghvendrapanda

      Hy, I have created a email page by using the following code MailMessage msg = new MailMessage(); msg.To = txtTo.Text; msg.From = txtFrom.Text; msg.Subject = txtSubject.Text; msg.Body = txtContent.Value; lblStatus.Text = "Sending..."; SmtpMail.Send(msg); but when i run the page the mail is not sent.... do i have to use SmtpMail.SmtpServer for sending the mail? plz help... regards

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

      first of all you have to Configure your SMTP Server for sending mail.

      raghvendrapanda wrote:

      msg.To = txtTo.Text;

      You can't do like this, because its take only type of MailAddress or MailAddressCollection object. So use

      msg.To=new MailAddress(TxtTo.Text)

      For sending Mail

      SmtpClient _smtServer=new SmtpClient("MyServer");
      _smtServer.Send(msg);

      cheers, Abhijit

      R 2 Replies Last reply
      0
      • A Abhijit Jana

        first of all you have to Configure your SMTP Server for sending mail.

        raghvendrapanda wrote:

        msg.To = txtTo.Text;

        You can't do like this, because its take only type of MailAddress or MailAddressCollection object. So use

        msg.To=new MailAddress(TxtTo.Text)

        For sending Mail

        SmtpClient _smtServer=new SmtpClient("MyServer");
        _smtServer.Send(msg);

        cheers, Abhijit

        R Offline
        R Offline
        raghvendrapanda
        wrote on last edited by
        #3

        Hy, Thankz for replying to my querry..but can u tell me that how can i Configure my SMTP Server for sending mail.

        A 1 Reply Last reply
        0
        • R raghvendrapanda

          Hy, Thankz for replying to my querry..but can u tell me that how can i Configure my SMTP Server for sending mail.

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

          How To Configure SMTP[^]

          cheers, Abhijit

          1 Reply Last reply
          0
          • A Abhijit Jana

            first of all you have to Configure your SMTP Server for sending mail.

            raghvendrapanda wrote:

            msg.To = txtTo.Text;

            You can't do like this, because its take only type of MailAddress or MailAddressCollection object. So use

            msg.To=new MailAddress(TxtTo.Text)

            For sending Mail

            SmtpClient _smtServer=new SmtpClient("MyServer");
            _smtServer.Send(msg);

            cheers, Abhijit

            R Offline
            R Offline
            raghvendrapanda
            wrote on last edited by
            #5

            Hy, I configured the SMTP but it didnt help...I found a virtual directory where a default setting was present ..on tracking i found all my mail where stored in a folder(C:\Inetpub\mailroot\Queue)..and were not sent to the mail..what sholud i do in order to send them? you suggested me a code.. SmtpClient _smtServer = new SmtpClient("MyServer"); when i used this i get an exception that mail sending failed..

            A 1 Reply Last reply
            0
            • R raghvendrapanda

              Hy, I configured the SMTP but it didnt help...I found a virtual directory where a default setting was present ..on tracking i found all my mail where stored in a folder(C:\Inetpub\mailroot\Queue)..and were not sent to the mail..what sholud i do in order to send them? you suggested me a code.. SmtpClient _smtServer = new SmtpClient("MyServer"); when i used this i get an exception that mail sending failed..

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

              raghvendrapanda wrote:

              SmtpClient _smtServer = new SmtpClient("MyServer");

              Did you put your SMTP server name over "MyServer"

              cheers, Abhijit

              R 1 Reply Last reply
              0
              • A Abhijit Jana

                raghvendrapanda wrote:

                SmtpClient _smtServer = new SmtpClient("MyServer");

                Did you put your SMTP server name over "MyServer"

                cheers, Abhijit

                R Offline
                R Offline
                raghvendrapanda
                wrote on last edited by
                #7

                Hy, i changed Myserver to local host and de mail got stored in C:\Inetpub\mailroot\Queue.. i created a new remote domain and named it gmail.com ..And dn i added "RemoteServer" instead of MYSERVER .itz execution was sucessful..But again it went and got stored in.C:\Inetpub\mailroot\Queue.. (if i want to send my mail to gmail.com what should i do?)..Do i have to use sum other server for dis?or server permission is required?

                1 Reply Last reply
                0
                • R raghvendrapanda

                  Hy, I have created a email page by using the following code MailMessage msg = new MailMessage(); msg.To = txtTo.Text; msg.From = txtFrom.Text; msg.Subject = txtSubject.Text; msg.Body = txtContent.Value; lblStatus.Text = "Sending..."; SmtpMail.Send(msg); but when i run the page the mail is not sent.... do i have to use SmtpMail.SmtpServer for sending the mail? plz help... regards

                  S Offline
                  S Offline
                  Shazz Rock
                  wrote on last edited by
                  #8

                  Check your web.config file as far as my knowledge is concern we mention port number in web.config.

                  Shazz here to help you...

                  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