<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[una funzione che non parte :(]]></title><description><![CDATA[<p dir="auto">Salve a tutti,<br />
ho trovato uno script che verifica l'esistenza di un indirizzo email, ma  copio e incollo il codice nella mia pagina e chiamo la funzione, ma non  funziona nulla.<br />
il codice si trova su questa pagina:<br />
w w w .barattalo.it/2009/12/27/...mail-with-smtp/</p>
<p dir="auto">la funzione la chiamo con una semplice chiamata del tipo:</p>
<p dir="auto">validateEmailSmtp("<a href="mailto:miamail@mail.it" rel="nofollow ugc">miamail@mail.it</a>")</p>
<p dir="auto">ma mi appare la pagina bianca.</p>
<p dir="auto">Dove sbaglio?<br />
Grazie, ciao.</p>
]]></description><link>https://dev.connect.gt/topic/129201/una-funzione-che-non-parte</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 13:40:56 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/129201.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Jun 2010 09:49:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to una funzione che non parte :( on Wed, 09 Jun 2010 10:54:22 GMT]]></title><description><![CDATA[<p dir="auto">Grazie per la tua risposta RCayla, magari se potresti provarlo anche tu, te ne sarei grato.</p>
<pre><code class="language-php">function validateEmailSmtp($email, $probe_address="", $debug=false) {
    # --------------------------------
    # function to validate email address
    # through a smtp connection with the
    # mail server.
    # by Giulio Pons
    # barattalo.it scusa ho dovuto tagliare ma si capisce
    # --------------------------------
    $output = "";
    # --------------------------------
    # Check syntax with regular expression
    # --------------------------------
    if (!$probe_address) $probe_address = $_SERVER["SERVER_ADMIN"];
    if (preg_match('/^([a-zA-Z0-9\._\+-]+)\@((\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,7}|[0-9]{1,3})(\]?))$/', $email, $matches)) {
        $user = $matches[1];
        $domain = $matches[2];
        # --------------------------------
        # Check availability of DNS MX records
        # --------------------------------
        if (function_exists('checkdnsrr')) {
            # --------------------------------
            # Construct array of available mailservers
            # --------------------------------
            if(getmxrr($domain, $mxhosts, $mxweight)) {
                for($i=0;$i&lt;count($mxhosts);$i++){
                    $mxs[$mxhosts[$i]] = $mxweight[$i];
                }
                asort($mxs);
                $mailers = array_keys($mxs);
            } elseif(checkdnsrr($domain, 'A')) {
                $mailers[0] = gethostbyname($domain);
            } else {
                $mailers=array();
            }
            $total = count($mailers);
            # --------------------------------
            # Query each mailserver
            # --------------------------------
            if($total &gt; 0) {
                # --------------------------------
                # Check if mailers accept mail
                # --------------------------------
                for($n=0; $n &lt; $total; $n++) {
                    # --------------------------------
                    # Check if socket can be opened
                    # --------------------------------
                    if($debug) { $output .= "Checking server $mailers[$n]...\n";}
                    $connect_timeout = 2;
                    $errno = 0;
                    $errstr = 0;
                    # --------------------------------
                    # controllo probe address
                    # --------------------------------
                    if (preg_match('/^([a-zA-Z0-9\._\+-]+)\@((\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,7}|[0-9]{1,3})(\]?))$/', $probe_address,$fakematches)) {
                        $probe_domain = str_replace("@","",strstr($probe_address, '@'));

                        # --------------------------------
                        # Try to open up socket
                        # --------------------------------
                        if($sock = @fsockopen($mailers[$n], 25, $errno , $errstr, $connect_timeout)) {
                            $response = fgets($sock);
                            if($debug) {$output .= "Opening up socket to $mailers[$n]... Success!\n";}
                            stream_set_timeout($sock, 5);
                            $meta = stream_get_meta_data($sock);
                            if($debug) { $output .= "$mailers[$n] replied: $response\n";}
                            # --------------------------------
                            # Be sure to set this correctly!
                            # --------------------------------
                            $cmds = array(
                                "HELO $probe_domain",
                                "MAIL FROM: &lt;$probe_address&gt;",
                                "RCPT TO: &lt;$email&gt;",
                                "QUIT",
                            );
                            # --------------------------------
                            # Hard error on connect -&gt; break out
                            # --------------------------------
                            if(!$meta['timed_out'] &amp;&amp; !preg_match('/^2\d\d[ -]/', $response)) {
                                $codice = trim(substr(trim($response),0,3));
                                if ($codice=="421") {
                                    //421 #4.4.5 Too many connections to this host.
                                    $error = $response;
                                    break;
                                } else {
                                    if($response=="" || $codice=="") {
                                        //c'è stato un errore ma la situazione è poco chiara
                                        $codice = "0";
                                    }
                                    $error = "Error: $mailers[$n] said: $response\n";
                                    break;
                                }
                                break;
                            }
                            foreach($cmds as $cmd) {
                                $before = microtime(true);
                                fputs($sock, "$cmd\r\n");
                                $response = fgets($sock, 4096);
                                $t = 1000*(microtime(true)-$before);
                                if($debug) {$output .= "$cmd\n$response" . "(" . sprintf('%.2f', $t) . " ms)\n";}
                                if(!$meta['timed_out'] &amp;&amp; preg_match('/^5\d\d[ -]/', $response)) {
                                    $codice = trim(substr(trim($response),0,3));
                                    if ($codice&lt;&gt;"552") {
                                        $error = "Unverified address: $mailers[$n] said: $response";
                                        break 2;
                                    } else {
                                        $error = $response;
                                        break 2;
                                    }
                                    # --------------------------------
                                    // il 554 e il 552 sono quota
                                    // 554 Recipient address rejected: mailbox overquota
                                    // 552 RCPT TO: Mailbox disk quota exceeded
                                    # --------------------------------
                                }
                            }
                            fclose($sock);
                            if($debug) { $output .= "Succesful communication with $mailers[$n], no hard errors, assuming OK\n";}
                            break;
                        } elseif($n == $total-1) {
                            $error = "None of the mailservers listed for $domain could be contacted";
                            $codice = "0";
                        }
                    } else {
                        $error = "Il probe_address non è una mail valida.";
                    }
                }
            } elseif($total &lt;= 0) {
                $error = "No usable DNS records found for domain '$domain'";
            }
        }
    } else {
        $error = 'Address syntax not correct';
    }
    if($debug) {
        print nl2br(htmlentities($output));
    }
    if(!isset($codice)) {$codice="n.a.";}
    if(isset($error)) return array($error,$codice); else return true;
}
</code></pre>
<p dir="auto"><img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/54a3bffb-5e4a-4eb8-81dc-99b2072e5d05-175.gif?v=bb61372b9dc" class="not-responsive emoji emoji-customizations emoji--ciauz" style="height:1.4em;width:auto;vertical-align:middle" title=":ciauz:" alt="" /></p>
]]></description><link>https://dev.connect.gt/post/916656</link><guid isPermaLink="true">https://dev.connect.gt/post/916656</guid><dc:creator><![CDATA[dariomarco]]></dc:creator><pubDate>Wed, 09 Jun 2010 10:54:22 GMT</pubDate></item><item><title><![CDATA[Reply to una funzione che non parte :( on Wed, 09 Jun 2010 10:42:34 GMT]]></title><description><![CDATA[<p dir="auto">Se non posti il codice è difficile aiutarti...</p>
<p dir="auto">EDIT: Ho visto ora il codice alla pagina che hai linkato.<br />
Hai provato a mettere $debug = true?</p>
]]></description><link>https://dev.connect.gt/post/916637</link><guid isPermaLink="true">https://dev.connect.gt/post/916637</guid><dc:creator><![CDATA[rcayla]]></dc:creator><pubDate>Wed, 09 Jun 2010 10:42:34 GMT</pubDate></item></channel></rss>