MrFix Posted August 21, 2011 Posted August 21, 2011 Hi folks, I'm trying to receive some mails with the IMAP module in PHP. And it won't work yet. I keep getting the following error: Message: Unknown: Connection failed to 213.51.146.46,21: No route to host (errflg=2) I changed the serveradress (mail.home.nl) in the IP but that only worked for 1 error. This error is not gonna give up ^^. I work with CodeIgniter and I'm using the following class: http://www.phphulp.nl/php/script/overig/cl...p3-reader/1356/ (dutch btw) But I don't think it has anything to do with the code. Testing Environment: http://peterwessels.heliohost.org/Unified/...p/imap/connect/ The code: Controller <? function connect() { $data['username'] = "adres"; $data['password'] = "wachtwoord"; $data['server'] = "213.51.146.46"; $data['port'] = "21"; $data['mailboxName'] = "inbox"; $this->load->model('Imap_model'); $this->Imap_model->Imapmail($data); $connect = $this->Imap_model->connect(); if($connect == FALSE) { $this->load->view("failure"); } } ?> Model: <? public function Imapmail($data) { extract($data); $this->username = $username; $this->password = $password; $this->server = $server; $this->port = $port; $this->options = $options; $this->mailboxName = $mailboxName; return(true); } public function connect() { $options = ""; if(!empty($this->options) && is_array($this->options)) { while(list($key, $option) = each($this->options)) { $options .= "/" . $option; } } $adress = '{' . $this->server . ':' . $this->port . $options . '}' . $this->mailboxName; $mbox = @imap_open($adress, $this->username, $this->password); $this->connection = $mbox; if($mbox) { return true; } else { return false; } } ?> I hope you can check the firewall, if you can enable me to receive e-mails through imap. With kind regards, Peter Wessels Quote
Guest xaav Posted August 21, 2011 Posted August 21, 2011 It's not our fault: port 21 on 213.51.146.46 is closed. See for yourself. Quote
MrFix Posted August 21, 2011 Author Posted August 21, 2011 My bad. Sorry. But it is strange that my E-mail client (thunderbird) does work with that ip with that port. Quote
Krydos Posted August 22, 2011 Posted August 22, 2011 Isn't IMAP usualy port 143? I thought port 21 was usually FTP, but I guess you can use whatever port for whatever you want as long as it's open and both the server and the client both know what protocol they are using to communicate. Quote
Guest xaav Posted August 22, 2011 Posted August 22, 2011 Yeah, but he's trying to connect on port 21. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.