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. The Lounge
  3. MSDN: Am I missing something?

MSDN: Am I missing something?

Scheduled Pinned Locked Moved The Lounge
c++comsysadminarchitecturetutorial
15 Posts 12 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.
  • C Christian Graus

    When-ever I write a function to send an email, I'll be sure to make it take the server as a parameter, rather than store it in my config, but I'll be sure to hard code the message and the person to send it to. The sad thing is, there are places where people look to the MSDN for examples of how best to write real world code. Just like there were folks who used CArray instead of std::vector because they 'were Microsoft shops'.

    Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

    R Offline
    R Offline
    Rama Krishna Vavilala
    wrote on last edited by
    #6

    Christian Graus wrote:

    Just like there were folks who used CArray instead of std::vector because they 'were Microsoft shops'.

    CArray vs VC++ std::vector: I will use CArray anytime. In fact even now I prefer CArray because all the STL classes emit too many errors in boundschecker. Now STLPort is a different matter.

    Co-Author ASP.NET AJAX in Action CP Quote of the Day: It is the same Friday that blooms as a new enriching day with novelty and innovation for us every week. - Vasudevan Deepak Kumar

    C 1 Reply Last reply
    0
    • C Chris Maunder

      From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."

      public static void CreateTestMessage1(string server, int port)
      {
      string to = "jane@contoso.com";
      string from = "ben@contoso.com";
      string subject = "Using the new SMTP client.";
      string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
      MailMessage message = new MailMessage(from, to, subject, body);
      SmtpClient client = new SmtpClient(server, port);
      // Credentials are necessary if the server requires the client
      // to authenticate before it will send e-mail on the client's behalf.
      client.Credentials = CredentialCache.DefaultNetworkCredentials;

      client.Send(message);
      

      }

      Um...does it?

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #7

      Chris Maunder wrote:

      Um...does it?

      I've recently discovered that when I see something like that but I don't see an example, or an example that seems oddly wrong, to click on the "show VB code" and more often than not, voila, the example, in :sigh: VB. Because, usually, I've set the filter to show only C# language examples! ;) Marc

      Thyme In The Country
      Interacx
      My Blog

      D 1 Reply Last reply
      0
      • R Rama Krishna Vavilala

        Christian Graus wrote:

        Just like there were folks who used CArray instead of std::vector because they 'were Microsoft shops'.

        CArray vs VC++ std::vector: I will use CArray anytime. In fact even now I prefer CArray because all the STL classes emit too many errors in boundschecker. Now STLPort is a different matter.

        Co-Author ASP.NET AJAX in Action CP Quote of the Day: It is the same Friday that blooms as a new enriching day with novelty and innovation for us every week. - Vasudevan Deepak Kumar

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #8

        If you're using VC6, apart from the fact that you're in the dark ages, which has major repercussions especially if you are trying to write good C++, you'd be insane not to install a different version of STL.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        J 1 Reply Last reply
        0
        • C Christian Graus

          If you're using VC6, apart from the fact that you're in the dark ages, which has major repercussions especially if you are trying to write good C++, you'd be insane not to install a different version of STL.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          J Offline
          J Offline
          jlwarlow
          wrote on last edited by
          #9

          Christian Graus wrote:

          If you're using VC6, apart from the fact that you're in the dark ages,

          Welcome to 80% of the companies I've worked for. 80% also use Visual Source Safe 6.0 as their CVS!

          Never argue with an imbecile; they bring you down to their level, and beat you with experience. Blog

          1 Reply Last reply
          0
          • C Chris Maunder

            From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."

            public static void CreateTestMessage1(string server, int port)
            {
            string to = "jane@contoso.com";
            string from = "ben@contoso.com";
            string subject = "Using the new SMTP client.";
            string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
            MailMessage message = new MailMessage(from, to, subject, body);
            SmtpClient client = new SmtpClient(server, port);
            // Credentials are necessary if the server requires the client
            // to authenticate before it will send e-mail on the client's behalf.
            client.Credentials = CredentialCache.DefaultNetworkCredentials;

            client.Send(message);
            

            }

            Um...does it?

            cheers, Chris Maunder

            CodeProject.com : C++ MVP

            M Offline
            M Offline
            Machaira
            wrote on last edited by
            #10

            So did you let them know that the code sample isn't for the ServicePoint property? :sigh:

            1 Reply Last reply
            0
            • C Chris Maunder

              From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."

              public static void CreateTestMessage1(string server, int port)
              {
              string to = "jane@contoso.com";
              string from = "ben@contoso.com";
              string subject = "Using the new SMTP client.";
              string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
              MailMessage message = new MailMessage(from, to, subject, body);
              SmtpClient client = new SmtpClient(server, port);
              // Credentials are necessary if the server requires the client
              // to authenticate before it will send e-mail on the client's behalf.
              client.Credentials = CredentialCache.DefaultNetworkCredentials;

              client.Send(message);
              

              }

              Um...does it?

              cheers, Chris Maunder

              CodeProject.com : C++ MVP

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #11

              That sounds like a programmin' question pardner *Elaine loosens her custard pie revolver in it's holster* :-D

              Visit http://www.notreadytogiveup.com/[^] and do something special today.

              1 Reply Last reply
              0
              • C Chris Maunder

                From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."

                public static void CreateTestMessage1(string server, int port)
                {
                string to = "jane@contoso.com";
                string from = "ben@contoso.com";
                string subject = "Using the new SMTP client.";
                string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
                MailMessage message = new MailMessage(from, to, subject, body);
                SmtpClient client = new SmtpClient(server, port);
                // Credentials are necessary if the server requires the client
                // to authenticate before it will send e-mail on the client's behalf.
                client.Credentials = CredentialCache.DefaultNetworkCredentials;

                client.Send(message);
                

                }

                Um...does it?

                cheers, Chris Maunder

                CodeProject.com : C++ MVP

                Richard DeemingR Offline
                Richard DeemingR Offline
                Richard Deeming
                wrote on last edited by
                #12

                The VS2008 / .NET 3.5 page[^] has a very simple example in both C++ and J#, but the C# example is still the same.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                1 Reply Last reply
                0
                • M Marc Clifton

                  Chris Maunder wrote:

                  Um...does it?

                  I've recently discovered that when I see something like that but I don't see an example, or an example that seems oddly wrong, to click on the "show VB code" and more often than not, voila, the example, in :sigh: VB. Because, usually, I've set the filter to show only C# language examples! ;) Marc

                  Thyme In The Country
                  Interacx
                  My Blog

                  D Offline
                  D Offline
                  Dan Neely
                  wrote on last edited by
                  #13

                  A year or two ago MS blogged that they were writing the VB samples first and others later as time permitted. IT had something to do with VB coders being far less likely to be able to use an example in a C style language than the reverse. :rolleyes:

                  -- Join the Campaign to Help Stamp Out and Abolish Redundancy The preceding is courtesy of the Bureau of Unnecessarily Redundant Repetition Department.

                  1 Reply Last reply
                  0
                  • S Shog9 0

                    wrote:

                    Um...does it?

                    Yup. Ain't .NET great? You access important stuff without ever actually referencing it.

                    R Offline
                    R Offline
                    Ri Qen Sin
                    wrote on last edited by
                    #14

                    Like how Application.Run(Form1) gives you a full-fledged application.

                    ROFLOLMFAO

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      From the MSDN Docs "The following code example demonstrates accessing the ServicePoint property."

                      public static void CreateTestMessage1(string server, int port)
                      {
                      string to = "jane@contoso.com";
                      string from = "ben@contoso.com";
                      string subject = "Using the new SMTP client.";
                      string body = @"Using this new feature, you can send an e-mail message from an application very easily.";
                      MailMessage message = new MailMessage(from, to, subject, body);
                      SmtpClient client = new SmtpClient(server, port);
                      // Credentials are necessary if the server requires the client
                      // to authenticate before it will send e-mail on the client's behalf.
                      client.Credentials = CredentialCache.DefaultNetworkCredentials;

                      client.Send(message);
                      

                      }

                      Um...does it?

                      cheers, Chris Maunder

                      CodeProject.com : C++ MVP

                      A Offline
                      A Offline
                      AdamNThompson
                      wrote on last edited by
                      #15

                      Looks kind of like System.Net.Mail to me...

                      -Adam N. Thompson

                      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