Eden mail php imap connection failure - php

I try to get the Gmail inbox emails using Eden mail PHP from my localhost (XAMPP Apache server). But it throws a fatal error:
Fatal error: Uncaught Eden\Mail\Exception: Problem connecting to
ssl://imap.gmail.com:993. Check server, port or ssl settings for your
email server.
in C:\xampp\htdocs\edenMail\vendor\eden\mail\src\Imap.php:357
Stack trace:
0 C:\xampp\htdocs\edenMail\vendor\eden\mail\src\Imap.php(170): Eden\Core\Exception::i()
1 C:\xampp\htdocs\edenMail\vendor\eden\mail\src\Imap.php(357): Eden\Mail\Imap->connect()
2 C:\xampp\htdocs\edenMail\index.php(36): Eden\Mail\Imap->getMailboxes()
3 {main}
thrown in C:\xampp\htdocs\edenMail\vendor\eden\mail\src\Imap.php on line 357
I have used below code in Eden mail's index.php file with my own credentials.
$imap = eden('mail')->imap(
'imap.gmail.com',
'myEmailId',
'myPassword',
993,
true);
In addition to that, I have enabled IMAP/POP3 and turned on less secure apps as well in my Gmail settings.
I have encountered this error only when I try to connect from my localhost (Windows-Xampp-Apache server). But there is no error if test code in my web server working in Linux environment.
Could anyone please help me to connect the google imap.gmail.com to retrieve inbox emails?

I have followed the instructions given in the below link and got the issue resolved. I am sharing it as if may help anyone with the same issue.
https://www.hesk.com/knowledgebase/?article=72
Having problems getting Gmail to work with HESK? Try these settings.
» Email sending
To send emails using Gmail server enter these details:
SMTP Host: smtp.gmail.com
SMTP Port: 587
SSL Protocol: OFF
TLS Protocol: ON
SMTP Username: (your Gmail username)
SMTP Password: (your Gmail password)
Also make sure your "From email address" in HESK settings is set to your Gmail email address!
Still no luck? Check with your host if they have port 587 blocked in firewall.
» POP3 fetching
To fetch mail from Gmail server enter these details:
POP3 Host: pop.gmail.com
POP3 Port: 995
TLS Protocol: ON
POP3 Username: (your Gmail username)
POP3 Password: (your Gmail password)
Important: make 100% sure that "POP3 download" in your Gmail settings
is set to "Enable POP for mail that arrives from now on". If not,
Gmail will send all existing (even read) messages to HESK when it
first connects.
» IMAP fetching
To fetch mail using IMAP from Gmail server enter these details:
POP3 Host: imap.gmail.com
POP3 Port: 993
Encryption: SSL
POP3 Username: (your Gmail username)
POP3 Password: (your Gmail password)
» Error messages
Connection timed out
Required ports are probably blocked on your server's firewall. Ask your host to configure the firewall to allow TCP connections on ports 587, 995 and/or 993.
Some hosting companies will not do that due to their policies. In that case you will need to, in order to integrate Gmail with HESK, find another host or try the HESK cloud.
Permission denied
Try logging with your google account here to unlock it for application access.
Click the "Continue" button to Allow access to your Google account.
Password error: [AUTH] Username and password not accepted. Too many
login failures
Your username and/or password is not correct, double-check them ad remember passwords are CaSe SeNSiTiVe!
Password error: [AUTH] Web login required
See this article
Error: 0 could not connect to the host "pop.gmail.com"
This could mean that:
required ports are blocked on your server's firewall. Ask your host to unblock TCP connections on ports 587, 995 and/or 993
- OR -
SSL certificate verification fails on your server. Try this:
download this file
save it somewhere to your server, for example to C:\wamp\ssl\cacert.pem
open your php.ini file
find the line
;openssl.cafile=
and change it to the location of the cacert.pem file while also removing the starting ;
openssl.cafile=C:\wamp\ssl\cacert.pem
save and restart the server
test again

Related

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

'No Relay Access Allowed' in Swift Mailer

I recently transferred my server to VPS & now email function doesn't work for external emails.
Following are the settings I'm using:
$transport = Swift_SmtpTransport::newInstance('ns1.example.com', 465, 'ssl')
->setUsername('testing#example.com')
->setPassword('password');
$mailer = Swift_Mailer::newInstance($transport);
And the error that I'm getting is this:
SMTP error from remote mail server after initial connection:
host dedrelay.where.example.net [XX.XXX.XXX.XX]: 554
m1plded02-01.prod.mesa1.example.net : DED :
gWqF1p02c0cB4sG01 : DED : ESMTP
No Relay Access Allowed From XXX.XXX.XXX
I've tried telnet & response is ok. I've tried following:
telnet ns1.example.com 465
Response was:
connected to xx.xxx.xxx.xx
I'm also not able to configure my desktop email client. Can anyone tell a solution? Any help will be appreciated.
EDIT
I'm not even able to send an email through server's webmail. Same error.
You tried telnet ns1.example.com 465 and it connected. This shows the SMTP server is up and running and your computer can reach it. But this is not all you need.
The error message No Relay Access Allowed From 123.123.123.123 means the SMTP server is configured to not accept emails from this IP address for relay, i.e. emails that needs to be passed to another server for delivery.
This is an anti-abuse measure and it means the SMTP server is configured correctly.
There is nothing wrong with your SwiftMailer configuration. Any email client (including the desktop client, as you said) you use, the answer is the same.
You need to contact the system administrator of the SMTP server and ask them to allow your IP address to use their SMTP server as relay. If they are your ISP it's also possible that the server allows relay only after authentication: you have an username/password pair (that you use to read the emails, f.e.) and you need to use it in order to send emails through their SMTP server. But this is only a supposition (this is how it usually works); you have to ask them to know for sure.

Sending email in WordPress

my wordpress site email goes to Spam with php function,some site offer me using wp-mail-smtp plugin will repair my problem, but it doesn't help me!
when I use php mail() function my emails goes to spam
and when i use SMTP, i have an error like this: SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
i use this settings for smtp (in wp-mail-smtp plugin):
From Email: noreply#mydoamin.com
SMTP host: smtp.gmail.com
SMTP port: 465
Encryption: Use SSL encryption
Authentication: Yes: Use SMTP authentication
Username: myEmail#gmail.com
Password: mypassword
this settings give me an error!
note: i use captcha code and my server tell me port 465 is Open!
how can I send email in my wordpress site ?
A connection timed out means that the connection isn't going through. This could be your host, since I just checked your settings - they look OK!
I would look into contacting your host with this. For all I know, that's all you can do, unless you are going to use a 3rd party mail API.
A connection timeout means your host is dropping your outbound request to Gmail. You'll need to send your Gmail out on the HTTPS port using a WordPress plugin called Postman SMTP.

How to read Rediffmail and hotmail using IMAP

I am trying to access all unread emails of rediff and hotmail using PHP IMAP. I am trying to use imap.live.com:995/imap/ssl as host name for rediffmail but it failed with an error no host found. But when i try for gmail it works.
gmail : IMAP HOSTNAME '{imap.gmail.com:993/imap/ssl}INBOX' POP3 HOSTNAME: '{pop.gmail.com:993/ipop3/ssl}INBOX' Does Rediffmail and Hotmail provide any such service to access mailbox.
Hotmail IMAP server settings
Server address: imap-mail.outlook.com
port: 993
So your url will be imap-mail.outlook.com:993/imap/ssl
imap.rediffmail.com port 143. 143 is the default port for IMAP. May I ask why you didn't try that yourself?

Swiftmailer at 1and1 hosting

I have troubleshooting with sending emails at 1and1 hosting.
I use swift mailer lib message I receive is stream_socket_client(): unable to connect to mrvnet.kundenserver.de:0 http://mrvnet.kundenserver.de:0 (Connection timed out).
Does anyone have similar troubles? Any solution?
PS. At my localhost everything is OK.
I fix SMTP after contact with their support team.
SMTP parameters:
HOST: mrvnet.kundenserver.de
PORT: 25
AUTH: without auth
Contacted support, they asked me do not use encryption (neither ssl nor tls, both not acceptable), so my options are:
host: smtp.1and1.com
port: 25
login: somemail#somedomain.com
passwd: somestrongpassword=)
as you may mention i use 1and1's mail (same settings for gmail would not work)

Categories