unable to connect to hostgator using imap library in codeingiter - php

I tried to get emails from gmail server using imap library
$this->conn = imap_open("{".$this->server.":993/imap/ssl}INBOX",$this->user,$this->pass);
I got error like:
Message: imap_open(): Couldn't open stream {mail.server.com:993/ssl}
It was start working after I unchecked the less secure apps option from my gmail account and then got emails.
but when i used to get emails from hostgator server i got same error
Message: imap_open(): Couldn't open stream {mail.server.com:993/ssl}
Message: Unknown: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Authentication failed. (errflg=2)
Message: Unknown: Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed. (errflg=1)
Like gmail server is their any option that i should check or uncheck in hostgator server. or any other method I should used?

Related

PHP imap_errors standard list of error responses

I've successfully tested multiple email server connections. I've also tested the responses when intentionally submitting incorrect credentials (wrong pass word).
Here are the server responses for failed authentication via print_r(imap_errors());:
AOL: imap_open(): Couldn't open stream
{imap.aol.com:993/ssl/imap}Unknown: [AUTHENTICATIONFAILED] LOGIN
Invalid credentials (errflg=1)
Gmail: imap_open(): Couldn't open stream
{imap.gmail.com:993/ssl/imap}Unknown: [AUTHENTICATIONFAILED] Invalid
credentials (Failure) (errflg=1)
Outlook: imap_open(): Couldn't open stream
{imap-mail.outlook.com:993/ssl}Unknown: LOGIN failed. (errflg=1)
imap_open(): Couldn't open stream
{imap-mail.outlook.com:993/ssl}Unknown: LOGIN failed. (errflg=1)
Yahoo: imap_open(): Couldn't open stream
{imap.mail.yahoo.com:993/novalidate-cert/ssl/imap}Unknown:
[AUTHENTICATIONFAILED] LOGIN Invalid credentials (errflg=1)
I also want to be able to test other possible error messages. I looked at the documentation for imap_errors however there wasn't anything useful there.
Each failed authentication response does contain the same string (errflg=1); where can I find the list of these strings so I can test how to handle any other types of errors?
The location of the error in PHP's source code is located at php-src-master\ext\imap\php_imap.c though I'm not familiar with C:
php_error_docref(NULL, E_NOTICE, "%s (errflg=%ld)", ecur->LTEXT, ecur->errflg);

imap_open(): Couldn't open stream for hostgator server {mail.mydomain.com:993/imap/ssl}INBOX in codeigniter

I am working in codeigniter framework using imap library. I want to get all mails from my mail server into my web app.
My code is working fine when i am using
imap_open("{imap.gmail.com:993/imap/ssl}INBOX", my_email, my_password);
but whenever I tried to get access of my hostgator mail server I got these type of errors.
1: imap_open(): Couldn't open stream {mail.mydomain.com:993/imap/ssl}INBOX
2: Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed. (errflg=1).
3: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Authentication failed. (errflg=2)
According the HostGator Documentation you should provide (for secured imap):
A username, your full email address
Your password
Your full server name
Port: 993
SSL: SSL/TLS
You should end up with something like
imap_open("{full.servername.com:993/imap/ssl/tls}", "my.email#servername.com","pwd");
You could also try the normal incoming mail settings which requires
A username, your full email address
Your password
Your full server name
Port: 143
SSL: none
Resulting in:
imap_open("{full.servername.com:143}", "my.email#servername.com","pwd");

imap open gives error for custom email laravel

I am trying to connect custom email through imap but receiving error imap_open(): Couldn't open stream {domain.com:993/imap/ssl}. TLS/SSL failure for domain.com:. Can please let me know what is wrong here.

Yahoo - imap_open()

I don't found right answer, how to connect yahoo imap mail server. Other connection works (gmail, outlook, hotmail), but yahoo not.
imap_open("{imap.mail.yahoo.com:993/imap/ssl/novalidate-cert}INBOX", "email_address", "password");
Error exception:
Unknown: Retrying PLAIN authentication after [AUTHENTICATIONFAILED] AUTHENTICATE Invalid credentials (errflg=1)
I tryed without novalidate-cert, but nothing.
I found solution
Click the "Allow apps that use less secure sign in" switch
https://www.wikihow.com/Configure-Mozilla-Thunderbird-for-Yahoo!-Mail

PHP imap_open(): Couldn't open stream to gmail

I'm getting this messages when I tried to use php-imap to retrieve emails from server using IMAP protocol. I started with gmail accounts. But when I tried to connect using imap_open() I get the following messages:
Warning: imap_open(): Couldn't open stream {imap.gmail.com/imap/ssl:993}INBOX in \path\to\file\imap.php on line 6
or
Warning: imap_open(): Couldn't open stream {imap.gmail.com/imap/ssl/novalidate-cert:993}INBOX in \path\to\file\imap.php on line 6
depending if I use or not novalidate-cert
I found some related question, but not the solution
imap_open(): Couldn't open stream
Getting Error like imap_open(): Couldn't open stream in server
Connecting to Gmail IMAP PHP "Couldn't open stream"
Is it possible connect to email using the imap php extension?
If, Yes. How can I solved this message?
If, No. Which alternative for received email using PHP could be possible?
Try imap.gmail.com:993/imap/ssl. Port number comes after the domain name and befor the URI path.

Categories