edxell / php-smtp-email-validation

Automatically exported from code.google.com/p/php-smtp-email-validation
0 stars 0 forks source link

can I add External SMTP to the script? #30

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi

running script on single smtp ( local host ) may blacklist the IP.... So can I 
use multiple SMTP or external SMTP ( with credentials ) with the script? so it 
would be easier to work on....

Original issue reported on code.google.com by bhavi...@gmail.com on 10 May 2014 at 10:11

GoogleCodeExporter commented 8 years ago
You can certainly change the script to use external SMTP servers. 

This portion chooses the SMTP server to use. 

https://code.google.com/p/php-smtp-email-validation/source/browse/trunk/smtp_val
idateEmail.class.php?spec=svn6&r=6#151

{{
// try each host
          while(list($host) = each($mxs)) {
           // connect to SMTP server
           $this->debug("try $host:$this->port\n");
           if ($this->sock = fsockopen($host, $this->port, $errno, $errstr, (float) $timeout)) {
            stream_set_timeout($this->sock, $this->max_read_time);
            break;
           }
          }

}}

That piece tries each mx host until it connects to one. You can change it so 
that $mx contains an array() of your external smtp hosts. You'll have to add 
the authentication code as well. 

Original comment by g...@fijiwebdesign.com on 11 May 2014 at 8:25