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. General Programming
  3. C#
  4. System.Net.Mail setup

System.Net.Mail setup

Scheduled Pinned Locked Moved C#
csharptutorialquestionworkspace
7 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.
  • D Offline
    D Offline
    dptalt
    wrote on last edited by
    #1

    When using this class how come the examples I see on the internet do not include statements for port number, username and password, and servername? I'm going to be using this class on a client app and I think I need to supply this information but do not know how to code it.

    F P Y D 4 Replies Last reply
    0
    • D dptalt

      When using this class how come the examples I see on the internet do not include statements for port number, username and password, and servername? I'm going to be using this class on a client app and I think I need to supply this information but do not know how to code it.

      F Offline
      F Offline
      fly904
      wrote on last edited by
      #2

      You need to use System.Net.Mail.SmtpClient[^] and then SmtpClient.Credentials[^]. Simple credential:

      client.Credentials = new System.Net.NetworkCredential(username, password);

      hmmm pie

      1 Reply Last reply
      0
      • D dptalt

        When using this class how come the examples I see on the internet do not include statements for port number, username and password, and servername? I'm going to be using this class on a client app and I think I need to supply this information but do not know how to code it.

        P Offline
        P Offline
        PauloCastilho
        wrote on last edited by
        #3

        System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient([Host], [Port]);
        smtp.Credentials = new System.Net.NetworkCredential([UserName], [Password]);

        If you prefer, use the config file (web.config, app.config).

        <system.net>
        <mailSettings>
        <smtp>
        <network host="" port="" userName="" password="" />
        </smtp>
        </mailSettings>
        </system.net>

        1 Reply Last reply
        0
        • D dptalt

          When using this class how come the examples I see on the internet do not include statements for port number, username and password, and servername? I'm going to be using this class on a client app and I think I need to supply this information but do not know how to code it.

          Y Offline
          Y Offline
          Yusuf
          wrote on last edited by
          #4

          I have seen many that give examples, but they wont give you real working one. See here[^] and here[^] for code examples

          Yusuf

          D 1 Reply Last reply
          0
          • D dptalt

            When using this class how come the examples I see on the internet do not include statements for port number, username and password, and servername? I'm going to be using this class on a client app and I think I need to supply this information but do not know how to code it.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            System.Net.Mail is not a class, but is a namespace. Documentation...[^]

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            1 Reply Last reply
            0
            • Y Yusuf

              I have seen many that give examples, but they wont give you real working one. See here[^] and here[^] for code examples

              Yusuf

              D Offline
              D Offline
              dptalt
              wrote on last edited by
              #6

              The code file in the second link is very cool. Thanks!

              Y 1 Reply Last reply
              0
              • D dptalt

                The code file in the second link is very cool. Thanks!

                Y Offline
                Y Offline
                Yusuf
                wrote on last edited by
                #7

                use it responsibly.

                Yusuf

                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