iCloud php imap is not connecting - php

I'm trying to access my icloud mailbox from my website. The code I'm using works fine with gmail, but when I try to connect to my iCloud account i get this error:
Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.mail.me.com:993/ssl/imap} in /hp/bd/ab/lq/www/rechner/Messages/MailAusgabe.php on line 6
and this is my code:
$mbox = imap_open("{imap.mail.me.com:993/ssl/imap}", "myemail#me.com", "mypassword");
and this aswell:
$mbox = imap_open("{imap.mail.me.com:993/ssl/imap}INBOX", "myemail#me.com", "mypassword");
I've already changed my password and tried some other accounts, but without success.

Try replacing this: "{imap.mail.me.com:993/ssl/imap}" by this: {imap.mail.me.com:993/imap/ssl}

Related

Fetch Office365 email from the email server in PHP

I am unable to fetch the emails from Office 365 mailbox using IMAP.
This used to work perfectly fine when we used to fetch the same from Gmail while now it is getting the following error:
Can't connect to 'hostname',port_number.
I got hostname by following this link => https://support.knowbe4.com/hc/en-us/articles/115006834408-How-To-Find-Your-Office-365-Host-Name
Please try use the /authuser method.
imap_open("{outlook.office365.com:993/imap/ssl/authuser=user#maindomain.com}", "user#maindomain.com", "password");

Open shared exchange email account with imap_open() PHP

In exchange environment I have PHP application setup to open and IMAP stream and parse emails. I have no problem connecting to my personal email account with the following:
imap_open("{exchange.server/ssl}INBOX", "username", "password");
Now I have been given access to a group email account and I'm wondering if its possible to specify other accounts with PHP's IMAP functions. I know when I setup outlook with a new profile I add the group email then my credentials with no problems.
I've also see telnet commands that support this in How can I access a shared Exchange mailbox with IMAP (over telnet)?
TELNET: ? LOGIN domain/username/mailboxname password
Using this logic I have tried:
imap_open("{exchange.server/ssl}INBOX", "username/sharedmailbox", "$password");
This gives an error I've also tried to add the domain with no luck.
Turns out I was very close with what I posted in the question however I was including #example.com for sharedmailbox#example.com in the imap_open(). Once I removed that I had no problem connecting with the following.
imap_open("{exchange.server/ssl}INBOX", "domain/username/sharedmailbox", "$password");

imap_open(): Couldn't open stream in Yii controller

I have really strange issue with imap_open function that it connects to some servers but fails with some servers. in the Yii controller I have
$inbox = imap_open("{".$model->incoming_hostname .":" .$model->incoming_port
."/ssl/novalidate-cert}",$model->e_mail_username,$model->e_mail_password);
Now when I submit parameters to connect to Gmail account I get the
imap_open("{imap.gmail.com:993/ssl/novalidate-cert}", "username", "password") and the inbox is opened fine, the same seems to work for yahoo. But for some reason I get error when connecting to outlook.com or icloud.com e-mail.
imap_open("{imap-mail.outlook.com:993/ssl/novalidate-cert}", "username", "password") gets error imap_open(): Couldn't open stream
What is really strange is that when I run the separate php script I made manually in shell for testing with the same parameters for connecting to outlook.com e-mail account it works fine. Also when I access this script through apache via web browser it also works. So this is not the problem of apache executing php code. But why does it fail in the Yii?
$hostname = '{imap-mail.outlook.com:993/ssl/novalidate-cert}';
$username = 'username';
$password = 'password';
/* try to connect */
$inbox = imap_open($hostname,$username,$password);
Any suggestions how to track this issue? In Yii I cannot see what could be the problem by calling imap_last_error() because Yii immediately displays error page for the warning
PHP warning
imap_open(): Couldn't open stream
{:993/ssl/novalidate-cert}
/var/www/..../controllers/RegisterController.php(102)
try this as hostname
$hostname='{imap-mail.outlook.com:993/imap/ssl}INBOX';
and also you pre check your username

problem in connectiong to imap server

i have three hours trying to connect to imap server with php
but i got that error
Warning: imap_open() [function.imap-open]: Couldn't open stream {213.175.202.118:143}INBOX in /home/user/public_html/imap.php on line 3
my code is
$mbox = imap_open("{ip:143}INBOX", "user", "password");
The mail details above is valid .. i have created it to test it
you can test it easily from your localhost !
i have three hours replacing in imap link
like
ip:143
imap.mydomain.com:143
etc ...
also i am sure i have imap installed on server .. <- i have Cpanel
problem Fixed !
Try (from http://php.net/manual/en/function.imap-open.php); looks ssl related:
<?php
imap_open( "{server.example.com:143/novalidate-cert}INBOX" , 'login' , 'password' );
?>

fetching gmail inbox with imap

i got a code from here to download gmail inbox:
http://davidwalsh.name/gmail-php-imap
use these 2 hostnames
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
{imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox
but getting this error.
Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert/norsh}Inbox in /home/medicalh/public_html/testmail.php on line 9
Cannot connect to Gmail: Can't connect to gmail-imap.l.google.com,993: Connection timed out
i have searched on stackoverflow but did't got solution
thanks
change you host name to this one and try
$hostname= '{imap.gmail.com:993/ssl/novalidate-cert}';
and double check the username and password
Open the php.ini file and remove ; before ;extension=php_imap.dll
and restart your server.
Your code will work...
You can download my Gmail class at my website: . I have also included a test file for you to test the class file.
If it does not work, I believe it could be your server's problem. You should contact your system administrator.
One of the issues with gmail IMAP SSL authentication is related to Google's account security.Once you get the login error once, sign out of all your google accounts. Then, visit this link:
https://accounts.google.com/DisplayUnlockCaptcha
Log in with the account you're attempting to access via imap.
Follow the steps and you'll then be able to login in to gmail with php imap.
It's visually shown here:
http://jeffreifman.com/filtered-open-source-imap-mail-filtering-software-for-php/configuring-gmail/
source: http://php.net/manual/en/function.imap-open.php

Categories