title: Detect whether public IP address is dynamic or static
body: <p>There are several email servers refusing connections of clients with public dynamic IP addresses. For example many smtp servers receiving emails only accept connections to clients having static IP adresses to avoid spam emails which are directly sent from computers having dynamic IP addresses.</p>
  
  <p>When I looked for answers using google I only found information saying it is impossible to distinguish between static/dynamic addresses. So how do the email servers do it? Are there any databases providing information for specific IP ranges?</p>
  
  <p>Have a look at the MX records of <code>t-online.de</code> (one of the largest German email providers). Try to connect to <code>mx00.t-online.de:25</code> using Putty (raw mode) on a computer having a dynamic IP address. The mail server immediately closes the connection and does not even allow the client to send any command, while a connection of a server having a static IP is not refused.</p>
  
  <p>Or have a look at the following extract of a SMTP session:</p>
  
  <pre><code>220 mailin.rzone.de [joses mi173] ESMTP RZmta 29.19 ready
  EHLO Home-PC
  250-mailin.rzone.de [joses mi173] greets 87.179.163.89
  250-ENHANCEDSTATUSCODES
  250-8BITMIME
  250-PIPELINING
  250-DELIVERBY
  250-SIZE 104857600
  250 HELP
  MAIL FROM:&lt;sender@example.com&gt;
  250 2.1.0 &lt;sender@example.com&gt; Sender ok
  RCPT TO:&lt;recipient@example.org&gt;
  550 5.7.1 87.179.163.89 is a dynamic IP
  </code></pre>
  
  <p>This is the email server for customers of Strato, a German hosting company, which also denies access to clients having a dynamic IP address. Email addresses have been changed. I used a recipient address which is acceptable for <code>mailin.rzone.de</code>, so there is no relay issue.</p>
  
  <p>Also <a href="http://whatismyipaddress.com/blacklist-check" rel="noreferrer">http://whatismyipaddress.com/blacklist-check</a> states the following:</p>
  
  <blockquote>
    <p>Just because the IP is listed with a particular blacklist does not
    mean that you are sending spam, just that particular blacklist
    suggests not to accept mail directly from that IP address. Most
    residential Cable/DSL IP addresses that are <a href="http://whatismyipaddress.com/dynamic-static" rel="noreferrer">dynamically assigned</a> will
    indicate that they are blacklisted, meaning you should be sending from
    your ISP's mail server, not a mail server running on your own internet
    connection.</p>
  </blockquote>