CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2006
    Posts
    221

    How to get information about Smtp server

    Hi To ALL

    i want to write a program with mfc that will check a smtp server is working or not. (same for FTP)
    eg if my amtp server is "smtp.gmail.com" and port is 25 then how would i know that server is running.
    can i use atl server library function in my mfc based application.

    Thanks in Advance

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: How to get information about Smtp server

    [ moved thread ]

    To start you could open a network connection (socket) to the server on the specific port and see if you get a connection.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Nov 2006
    Posts
    221

    Re: How to get information about Smtp server

    Hi to All,

    how can i send mail from my smtp server to any mail address.
    i m trying this with socket but after connecting server with my socket i get an error 553
    how can i validate data on server(user name and passward) and get its response.

    Expecting a favorable reply
    Thanks in Advance

  4. #4
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664

    Re: How to get information about Smtp server

    Are you sure this is a socket error??? Looks more likely to be an SMTP error. Send some code and describe exactly when this happens.

    The "normal" way of sending mail SMTP->SMTP, is to first find the correct SMTP server IP. For instance, if a mail should be delivered to Joe@example.com... your SMTP server must first find the MX record of the domain "example.com". The MX (mail exchange) record is a DNS record which will give you the host name to the service that handles mail exchange for the specified domain (in this case "example.com"). If it is a valid mail address that you will send to, a MX record is returned (=hostname of the SMTP server). Now, call gethostbyname(<MX of example.com>) to get the IP and then connect as usual, and then start talk SMTP etc etc.

    Use the DNS API in Windows 2000/XP to lookup MX records, or implement your own resolver (see RFC for DNS).

    Hope it helps.

  5. #5
    Join Date
    Nov 2006
    Posts
    221

    Re: How to get information about Smtp server

    I cant use DNS API because i m working on vc6.0 and this api is not available here.
    There r some problem
    1: if i send a mail with my smtp and it routs this to another server then how can i get this server name.
    2: if my server take authentication then how can i validate user name and passward

  6. #6
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664

    Re: How to get information about Smtp server

    It doesn't matter if you are compiling with VC6, VC7 etc... the DNS API is platform dependant. Download the Platform SDK if needed.

    Read the SMTP RFC (http://www.faqs.org/rfcs/rfc821.html) for details on the SMTP the protocol (including auth).

  7. #7
    Join Date
    May 2011
    Location
    Pune India
    Posts
    4

    Re: How to get information about Smtp server

    Hi All,

    I am using a Win 2k8 box and trying to find the Default SMTP address of the machine.

    I cant find anything in the registry that can give me the SMTP Address.

    I tried searching in the registry entry : \Software\Microsoft\Internet Account Manager
    but no luck.

    I can't use third party assemblies. Need standard C++ code.

    Any help will be appreciated.

    Thanks
    Sagar

  8. #8
    Join Date
    Feb 2002
    Posts
    4,640

    Re: How to get information about Smtp server

    You should start a new thread, instead of waking one that is 4 years old. However, why do you think the default SMTP server is stored in the registry? There's no place in a standard Windows install to enter this data.

    In other words, you can't find it because it isn't there.

    Viggy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured