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 / C++ / MFC
  4. mail server

mail server

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmintutorialquestion
4 Posts 4 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.
  • G Offline
    G Offline
    gamitech
    wrote on last edited by
    #1

    sorry for asking this question for the hundredth time but I've never got an answer how to get the MX server. I want to make a program that can send an email from you computer and for each mail address I have to write the SMTP server. I want a function that get's it automatically. Thankx gabby

    M A P 3 Replies Last reply
    0
    • G gamitech

      sorry for asking this question for the hundredth time but I've never got an answer how to get the MX server. I want to make a program that can send an email from you computer and for each mail address I have to write the SMTP server. I want a function that get's it automatically. Thankx gabby

      M Offline
      M Offline
      Muthukumar
      wrote on last edited by
      #2

      If you are using MAPI try this. You should have a profile name supplied. HRESULT GetServerName(LPSTR rszProfileName) { HRESULT hRes = S_OK; LPPROFADMIN pAdminProfiles = NULL; LPSERVICEADMIN pSvcAdmin = NULL; LPPROFSECT pGlobalProfSect = NULL; LPSPropValue pProps = NULL; // Get a Profile admin object if ( FAILED ( hRes = MAPIAdminProfiles ( 0L, &pAdminProfiles ) ) ) return hRes ; // Get a ServiceAdmin object if ( FAILED ( hRes = pAdminProfiles -> AdminServices ( rszProfileName, NULL, 0L, // Your app's window handle 0L, &pSvcAdmin ) ) ) return hRes ; // Get the Global Profile Section by calling // IServiceAdmin::OpenProfileSection use pbGlobalProfileSectionGuid // defined in EDKMDB.H as the entry ID to request // The default return is an IProfSect interface. if ( FAILED ( hRes = pSvcAdmin -> OpenProfileSection ( (LPMAPIUID)pbGlobalProfileSectionGuid, NULL, 0L, &pGlobalProfSect ) ) ) return hRes ; // Call HrGetOneProp to get PR_PROFILE_HOME_SERVER if ( FAILED ( hRes = HrGetOneProp ( pGlobalProfSect, PR_PROFILE_HOME_SERVER, &pProps ) ) ) return hRes ; CString m_strServerName = pProps -> Value.lpszA ; if ( NULL != pAdminProfiles ) pAdminProfiles -> Release (); if ( NULL != pSvcAdmin ) pSvcAdmin -> Release ( ); if ( NULL != pGlobalProfSect ) pGlobalProfSect -> Release ( ); if ( NULL != pProps ) MAPIFreeBuffer ( &pProps ); pSvcAdmin = NULL; pGlobalProfSect = NULL; pProps = NULL; pAdminProfiles = NULL; // Return the HRESULT to the calling function return hRes; } The above code might have some variables not declared. Pls check it out before using. Muthukumar.V Home: WWW.CoderSource.Net

      1 Reply Last reply
      0
      • G gamitech

        sorry for asking this question for the hundredth time but I've never got an answer how to get the MX server. I want to make a program that can send an email from you computer and for each mail address I have to write the SMTP server. I want a function that get's it automatically. Thankx gabby

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        If you're wanting to write your own SMTP server application I recommend reading RFC 2821. In regards to your question about how to obtain an MX record for a particular domain (example: yahoo.com, hotmail.com, etc...), you will need to need to query DNS. A good place to start to would be to use google.com, or better yet, if you're just looking for a quick solution, try this link. http://www.codeguru.com/Cpp/I-N/internet/dns/article.php/c6163/ Regards, John

        1 Reply Last reply
        0
        • G gamitech

          sorry for asking this question for the hundredth time but I've never got an answer how to get the MX server. I want to make a program that can send an email from you computer and for each mail address I have to write the SMTP server. I want a function that get's it automatically. Thankx gabby

          P Offline
          P Offline
          Paul Ranson
          wrote on last edited by
          #4

          Your best bet is to relay through an existing mail server, just like Outlook Express does. But if you really need to do it directly, and expect to run on Windows 2000 onwards, then checkout the DNS API, DnsQuery specifically. Otherwise you'll have to look up the DNS spec, find out how to locate your local DNS server and do the query manually. Paul

          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