Yahoo - imap_open() - php

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

Related

unable to connect to hostgator using imap library in codeingiter

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?

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");

Mail is not sent every time by swiftmailer using office365

Smtp details which we use are correct, for host smtp.office365.com mail is not sent every time.
Sometimes this error is generated,
Fatal error: Uncaught Swift_TransportException: Failed to authenticate on SMTP server with username "XXX" using 2 possible authenticators in vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php on line 181
Observed behaviour
Sometimes with the same details, emails are sent.
Expected behaviour
It should send an email every time.
Can anyone please tell me what should I do?
Is the login credentials you used correct and the.env file configured correctly? Here are two links that might be useful to you.
PHP Fatal error: 'Swift_TransportException' with message 'Failed to authenticate on SMTP server
Failed to authenticate on SMTP server error using gmail

imap php not working

I am trying to run imap_open() in on my server but its giving me this error.
Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home/bestinsaudi2/public_html/mailbox.php on line 55
Cannot connect to Gmail: Can not authenticate to IMAP server: [ALERT] Please log in via your web browser: https://support.google.com/mail/acco
I have enabled imap in gmail account i am using .I also enabled less secure apps. I copied code from david walsh . His credentials is giving this error.
Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX in /home/bestinsaudi2/public_html/mailbox.php on line 55
Cannot connect to Gmail: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
I am writing down the code i am using with my own credentials.
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'myemail#gmail.com';
$password = 'mypassword';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
here is one more thing i am not using wamp or xamp server i am using ipower. Somewhere i found to run command like $ composer require secit-pl/imap-bundle
And its confusing .How to and where to run this and is it necessary with my code? Also do i have to download any library for this ? or should some additional step?
If less secure apps are enabled, and the app password is not working or not desired, it might be that google has found the IP address that your imap is using to be suspicious and blocked it.
Log into that account from a browser and check for an email from that has the subject "Critical security alert". The date on the email should be around the same time that imap stopped working. If you find such an email, it should spell out that a sign-in attempt was blocked, and have a big button that says "Check activity". When you click the button, it will ask if the sign in that it blocked was actually from you. Indicate that it was, and you should be able to sign in with imap again from that IP.
If you or someone else has already indicated that it was or was not them, there is an option to change your answer.
When google decides to do this, it only sends a single email. So if it's been a few days, that email might be buried in the inbox. It does not get resent for each blocked sign in from that IP.
You are probably looking for gmail setup for something called "Less Secure Apps":
https://support.google.com/accounts/answer/6010255?hl=en
that's why it requires you to log in with a browser.
After you set this up correctly, and enable less secure apps, this should work nicely, just checked with my own account.
EDIT: is safe apps is alredy enabled, you may need to create App Password:
https://support.google.com/mail/answer/185833?hl=en
and change your credentials to:
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'email#gmail.com';
$password = 'app password here, not your gmail password';
EDIT2: App Password functionality require to have 2-Step verification enabled

PearMailer, PHP7, and OpenSSL unable to connect to gmail with unknown error

I'm building a website, and part of it needs to send emails (one for account password reset links, the other for general user-admin contact). I've been using PearMailer to send emails through a GMail account, and that's worked fine...until now. For some reason, it's stopped sending emails, and it's giving me this very unhelpful error:
[message] => Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) (code: -1, response: )
openSSL is enabled, and all the credentials I'm using are correct (I can manually sign in to that GMail account using them).
This is the code I'm using, where $config holds the account credentials, and the $_POST data is from the Contact Us form (ignore the lack of sanitization on it while I'm developing):
require_once "Mail.php";
$params=array(
"host"=>"ssl://smtp.gmail.com",
"port"=>465,
"auth"=>true,
"username"=>$config["mailFrom"],
"password"=>$config["mailPass"]
);
$headers=array(
"To"=>$config["mailFrom"],
"From"=>$_POST['user']." <".$_POST["reply-to"].">",
"Content-type"=>"text/html",
"Subject"=>$_POST['subject']
);
$mail=Mail::factory("smtp", $params);
$sent=$mail->send($config["mailFrom"], $headers, htmlentities($_POST['body']));
It should be sending my GMail account an email from itself, but instead, it's giving me the error I mentioned above. After changing the to and from addresses, no matter what, it still gives me that error. Which is especially strange, since almost identical code is what I've been using to send password reset links, and that was working fine until just now; of course, it too is now failing to connect.
I can't find anything saying Google has changed its settings, and I absolutely haven't gone over the 2,000 messages per day limit that smtp.gmail.com is supposed to allow, so what's going on here?
My solution: switched from PearMailer to SwiftMailer, and in that, I'm setting the SSL options verify_peer and verify_peer_name to false using $transport->setStreamOptions. That seems to send mail just fine now. (Without those options disabled, apparently GMail's SSL certificates aren't compatible with newer versions of PHP. Go figure.)
EDIT:
I'm not really sure if this will work for you, try:
$params=array(
"host"=>"smtp.gmail.com",
"port"=>587,
"auth"=>true,
"username"=>$config["mailFrom"],
"password"=>$config["mailPass"]
);
This will use TLS instead of SSL. Give it a try.

Categories