Welcome Guest, Not a member yet? Register   Sign In
socks smtp and CI
#1

[eluser]Gewa[/eluser]
Hi In our website we have a such problem. We should send messeges from the smtp server to which we can connect only throw socks4 or socks5.
What you can advice me. Does email class support socks connection, and can you give a sample ..???
OR where I can read on it. Thanks beforehand
#2

[eluser]Derek Allard[/eluser]
Can you give me an example of how you'd send mail outside of CI? Then I'll do my best to help you with the CI equivalent.
#3

[eluser]Gewa[/eluser]
for example this

Code:
<?
$socket = fsockopen('127.0.0.1',6666,$err,$errstr,10);
$h=pack("H*","0401").pack("n",25).pack("H*",dechex(ip2long('198.165.2.4'))).pack("H*","00");
fwrite($socket,$h);
$l=bin2hex(fread($socket,1024));
$ver=substr($l,0,2);
$status=strtolower(substr($l,2,2));
if($ver==00)
{
if($status=='5a')
{
    fwrite($socket,"HELO localhost\r\n");
    $l=fread($socket,1024);
    fclose($socket);
    echo($l);
}
else
{
  echo "Not connected";
}
}else{echo "Version is wrong";}
?>
#4

[eluser]Gewa[/eluser]
Actually Derek, my client need that at first the socks database would be checked , if they work on the mail server we want to use or not ( we have ~130 socks) and then use them, the code I provided is the part that as I told will try to connect to the IP of SMTP throght Socks '127.0.0.1:6666'


1.Is there an easyer way to do the check in CI? Maybe there is a model or class already for socks?
2. Can you tell me how can we make a parralel connections in CI ( when for example 3-4 smtp connections throght socks are made parralely so that the scripts works faster ???)

This will solve 99% of the problem if you will help.
Thanks beforehand
#5

[eluser]Derek Allard[/eluser]
Have you tried setting the protocol to "smtp", and setting smtp_host, smtp_user, smtp_pass, smtp_port, etc?
#6

[eluser]Gewa[/eluser]
actually no. Is there a setting also for SOCKS..?
#7

[eluser]Derek Allard[/eluser]
Code:
function _smtp_connect()
    {
        $this->_smtp_connect = fsockopen($this->smtp_host,
                                        $this->smtp_port,
                                        $errno,
                                        $errstr,
                                        $this->smtp_timeout);

        if( ! is_resource($this->_smtp_connect))
        {        
            $this->_set_error_message('email_smtp_error', $errno." ".$errstr);
            return FALSE;
        }

        $this->_set_error_message($this->_get_smtp_data());
        return $this->_send_command('hello');
    }
Could you try the smtp thing please. Don't forget to use email debugger so you can get any messages returned.
#8

[eluser]Gewa[/eluser]
thank you very much, i will try this code. and will get back as soon as I have any problem...Smile
#9

[eluser]Gewa[/eluser]
Actually this your function doesn't help Sad((( 1) I didn't understand, should I use it directly in controller or ??

2. Here I dont see where should i give Socks4 or Socks5 proxy ip and port to send email via them by connecting to SMTP server. Can you make a liitle more describing?

Thanks beforehand
#10

[eluser]Derek Allard[/eluser]
That function is part of the email library. The fsockopen code is called if you try to connect via smtp. Perhaps you could take a few moments to go through libraries/email.php and check out the code. I don't have any specific experience with sock connections.




Theme © iAndrew 2016 - Forum software by © MyBB