CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    2

    Getting servers for sending mail via SMTP

    I have looked in this article:

    http://www.codeguru.com/Cpp/I-N/inte...icle.php/c6177

    It shows how to send mail via SMTP.
    However, in order to send email I need to connect to a server via mail.connect().
    My question is, how do I get the available server on the computer the program runs (the client)?

    Thanks in advance.

  2. #2
    Join Date
    Jul 2003
    Posts
    147

    Re: Getting servers for sending mail via SMTP

    Well, how do you know who the message is coming from? Either it is predefined, in which case you should already know the SMTP server or you need to get a "From" address from the user at which time you would need to get the SMTP connect info from the user as well.

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

    Re: Getting servers for sending mail via SMTP

    [ moved thread ]
    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 ]

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

    Re: Getting servers for sending mail via SMTP

    It can be done.

    You should extract the FQDN (domain name) of the recipient mail address, and then lookup its MX record (in DNS). The MX record contains a hostname which is resolved into an IP for the recipient's mail server (SMTP).

    NOTE: For security reasons, most SMTP servers will perform a reverse DNS lookup of the calling IP address and then use the FQDN to lookup the MX. If the calling IP doesn't have a MX record, it will most likely reject it.

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