PHP Getting imap open to work - php

I just moved my app to the cloud hosting. I was using imap_open to access mails in my gmail account. It worked fine.
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = '...#gmail.com';
$password = '****';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
Now I get an error Unable to create selectable TCP socket (1176 >= 1024) Does anybody have any idea about this error. I appreciate any help.
Thanks.

It looks to me like you've hit the maximum amount of open file descriptors. Maybe restarting your system?

Related

How do I resolve IMAP connectivity error?

Can anybody help regarding this issue. The email didn't received through the imap_open function. I have seen a problem with this function.
imap_open($hostname, $username, $password) or die('Cannot connect to Server: ' . imap_last_error());
First url with port
$hostname = '{imap-mail.outlook.com:143/imap}INBOX';
Second URL with port
$hostname = '{imap-mail.outlook.com:993/imap/ssl/novalidate-cert}INBOX';
I want to resolve this problem using imap_open function.

Getting error while fetching emails via imap

i have problem in IMAP
i am writing below code to fetch inbox emails
$hostname = '{mail.test.in:110}INBOX';
$username='name';
$password='password';
$inbox = imap_open($hostname, $username, $password) or die('Cannot connect to Gmail: ' . imap_last_error());
i am getting error
"message": "imap_open(): Couldn't open stream {mail.innovify.in:110}INBOX"
please let me know solution
According to the imap_open() documentation you need to provide a service flag if you are not using IMAP.
You are using port 110 which is for POP3, so you need to let imap_open() know about that by changing your connection string from
$hostname = '{mail.test.in:110}INBOX';
to
$hostname = '{mail.test.in:110/pop3}INBOX';

open different folder in inbox using PHP imap_open

I am using this PHP Code to open a POP3 mailbox:
$hostname = '{mail.domain.com/pop3:110/notls}INBOX';
$username = 'email#domain.com';
$password = '***';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect: ' . imap_last_error());
i am using the above code to open a POP3 mailbox
i tried using
$hostname = '{mail.domain.com/pop3:110/notls}INBOX';
to open a folder inside the inbox but i got the error:
Warning: imap_open() [function.imap-open]: Couldn't open stream {mail.domain.com/pop3:110/notls}INBOX.Support in /home/integra/public_html/autocheck/support_emails.php on line 31
how can i open different under my Inbox folder?
According to the docs you need use this format:
"{" remote_system_name [":" port] [flags] "}" [mailbox_name]
So
{mail.domain.com/pop3:110/notls}INBOX
should probably be
{mail.domain.com:110/pop3/notls}INBOX
Also make sure you can actually connect to the server on port 110, for example on a Linux/UNIX machine you can test this with:
$ telnet example.com 110
If you see Escape character is '^]'., you're connected.

PHP - IMAP connection to Gmail returns nothing

I am trying to connect to gmail using IMAP. When I try to load the script, the page just loads and and doesn't return anything. No error, no emails... it just tries loading.
I have IMAP enabled for PHP, and it's also enabled in my Gmail inbox.
$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$username = 'email#gmail.com';
$password = 'password';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
imap_close($inbox);
Any ideas why the script won't stop loading?
Firewall was blocking the port 993. Got it working. Thanks!

imap cross platform issue

I have develop a routine to open email boxes which are on different platform. It gives problem to open windows exchange if the code is running on linux and vice versa. How I can resolve this issue. I am using the following code open IMAP.
$hostname = '{pop.lcn.com:110/pop3}INBOX';
$username = 'abc#xyz.co.uk';
$password = 'xxxxx';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to mail server: ' . imap_last_error());
$emails = imap_search($inbox,"ALL" );
particularly the mail box on this server was going to open the mail box. but now its not going to open and giving conneciton timeout problem. when I check it from windows server then it was working fine. Now I do not know what kind of changes have on server. that script is not running.

Categories