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. SMTP server port

SMTP server port

Scheduled Pinned Locked Moved C#
sysadminhelptutorial
7 Posts 2 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.
  • T Offline
    T Offline
    TheJudeDude
    wrote on last edited by
    #1

    I have a small app that emails me a message every morning. I recently had to change the SMTP port from 25 to 587 on our server due to spam. So I went into the code and changed the SmtpMail.SmtpServer = 192.168.1.15 to 192.168.1.15:587. I am getting this error: The server response was 421 Cannot connect to SMTP server 192.168.1.15 (192.168.1.15:25), connect error 10061. It seems it is still trying to access on port 25. I looked around a bit, but could not find anything on how to change the port it uses. I thought adding the port to the end of the IP address would be sufficient. Thanx in advance

    Jude

    C 1 Reply Last reply
    0
    • T TheJudeDude

      I have a small app that emails me a message every morning. I recently had to change the SMTP port from 25 to 587 on our server due to spam. So I went into the code and changed the SmtpMail.SmtpServer = 192.168.1.15 to 192.168.1.15:587. I am getting this error: The server response was 421 Cannot connect to SMTP server 192.168.1.15 (192.168.1.15:25), connect error 10061. It seems it is still trying to access on port 25. I looked around a bit, but could not find anything on how to change the port it uses. I thought adding the port to the end of the IP address would be sufficient. Thanx in advance

      Jude

      C Offline
      C Offline
      coolestCoder
      wrote on last edited by
      #2

      Hi, Surprised to know that you are still using .Net framework 1.0 / 1.1. In v1.0 or v1.1 you need to set Fields property of MailMessage class's instance for changing default port like this -- objMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", NewServerPort) NewServerPort will be your port; in your case 587. Also objMessage is instance of MailMessage class. I will recommend you to use .Net 2.0 framework for sending mails, because it exposes appropriate properties for everything related to mails. There is a change in namespace and the new one is - System.Net.Mail. Hope this helps !


      "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


      coolestCoder

      T 1 Reply Last reply
      0
      • C coolestCoder

        Hi, Surprised to know that you are still using .Net framework 1.0 / 1.1. In v1.0 or v1.1 you need to set Fields property of MailMessage class's instance for changing default port like this -- objMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", NewServerPort) NewServerPort will be your port; in your case 587. Also objMessage is instance of MailMessage class. I will recommend you to use .Net 2.0 framework for sending mails, because it exposes appropriate properties for everything related to mails. There is a change in namespace and the new one is - System.Net.Mail. Hope this helps !


        "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


        coolestCoder

        T Offline
        T Offline
        TheJudeDude
        wrote on last edited by
        #3

        Thanx a lot! I am not an all day coder. I write little apps and scripts to help me out through the daily grind. I do the tech support work for a small business and my main job is keeping everything running smoothly and handling all the computer problems when they arise. I have .Net 2.0 installed, but how do I use it in VS2003?

        Jude

        C 1 Reply Last reply
        0
        • T TheJudeDude

          Thanx a lot! I am not an all day coder. I write little apps and scripts to help me out through the daily grind. I do the tech support work for a small business and my main job is keeping everything running smoothly and handling all the computer problems when they arise. I have .Net 2.0 installed, but how do I use it in VS2003?

          Jude

          C Offline
          C Offline
          coolestCoder
          wrote on last edited by
          #4

          Hi, I am afraid, but you cannot use .Net Studio 2003 for developing applications on framework 2.0. For that you will need VS.NET 2005 or VS.NET 2008. I think 2008 is a better choice since it can be used to develop applications that target all framework versions. Of course, the choice is yours (rather your company's) Hope this helps.


          "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


          coolestCoder

          T 1 Reply Last reply
          0
          • C coolestCoder

            Hi, I am afraid, but you cannot use .Net Studio 2003 for developing applications on framework 2.0. For that you will need VS.NET 2005 or VS.NET 2008. I think 2008 is a better choice since it can be used to develop applications that target all framework versions. Of course, the choice is yours (rather your company's) Hope this helps.


            "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


            coolestCoder

            T Offline
            T Offline
            TheJudeDude
            wrote on last edited by
            #5

            Thats what I thought. I installed VS2005 a while back, but it was buggy and a resource hog, so I uninstalled and stuck with 2003. I got a beta disk of VS2008 from MS last month, but have yet to play with it. What about with Monodevelop?

            Jude

            C 1 Reply Last reply
            0
            • T TheJudeDude

              Thats what I thought. I installed VS2005 a while back, but it was buggy and a resource hog, so I uninstalled and stuck with 2003. I got a beta disk of VS2008 from MS last month, but have yet to play with it. What about with Monodevelop?

              Jude

              C Offline
              C Offline
              coolestCoder
              wrote on last edited by
              #6

              TheJudeDude wrote:

              resource hog

              Just curious about your machine configuration :~

              TheJudeDude wrote:

              What about with Monodevelop?

              I have no idea about Monodevelop. I havent used it yet.


              "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


              coolestCoder

              T 1 Reply Last reply
              0
              • C coolestCoder

                TheJudeDude wrote:

                resource hog

                Just curious about your machine configuration :~

                TheJudeDude wrote:

                What about with Monodevelop?

                I have no idea about Monodevelop. I havent used it yet.


                "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


                coolestCoder

                T Offline
                T Offline
                TheJudeDude
                wrote on last edited by
                #7

                Abit VA-20, AMD Barton 2800+, 2GB Corsair DDR 400, 78 GB Raptor. Runs photoshop pretty good, and that is a horse.

                Jude

                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